X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=status.go;h=4124b7ee8cad3867442ce54844772a5f29a192f5;hb=0030b3e73152bf9d9ad3e435fa42e607c7865321;hp=7b45905cd089ef3fe49357b649d0dd375fad8ecd;hpb=ff2443f496cbf7f648b84a78e468dc3f130c37f2;p=goredo.git diff --git a/status.go b/status.go index 7b45905..4124b7e 100644 --- a/status.go +++ b/status.go @@ -1,6 +1,6 @@ /* goredo -- djb's redo implementation on pure Go -Copyright (C) 2020-2021 Sergey Matveev +Copyright (C) 2020-2022 Sergey Matveev This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -37,9 +37,17 @@ const ( var ( FdStatus *os.File - flagNoStatus = flag.Bool("no-status", false, "disable statusline (REDO_NO_STATUS=1)") + flagNoStatus *bool ) +func init() { + cmdName := CmdName() + if !(cmdName == CmdNameRedo || cmdName == CmdNameRedoIfchange) { + return + } + flagNoStatus = flag.Bool("no-status", false, "disable statusline (REDO_NO_STATUS=1)") +} + func statusInit() { if NoProgress || *flagNoStatus { return @@ -96,9 +104,9 @@ func statusInit() { CJS, done, CReset, ) } + out = erasedStatus(out, "\r") LogMutex.Lock() - os.Stderr.WriteString(erasedStatus(out, "\r")) - LogWasStatus = true + os.Stderr.WriteString(out) LogMutex.Unlock() } }()