-/*
-goredo -- redo implementation on pure Go
-Copyright (C) 2020 Sergey Matveev <stargrave@stargrave.org>
-
-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
-the Free Software Foundation, version 3 of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+// goredo -- djb's redo implementation on pure Go
+// Copyright (C) 2020-2024 Sergey Matveev <stargrave@stargrave.org>
+//
+// 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
+// the Free Software Foundation, version 3 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
package main
import (
"flag"
"fmt"
+ "log"
"os"
)
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 *flagNoStatus {
+ if NoProgress || *flagNoStatus {
return
}
if v := os.Getenv(EnvNoStatus); v == "1" {
var err error
r, FdStatus, err = os.Pipe()
if err != nil {
- panic(err)
+ log.Fatal(err)
}
go func() {
running := 0
CJS, done, CReset,
)
}
+ out = erasedStatus(out, "\r")
LogMutex.Lock()
- os.Stderr.WriteString(fillUpToTermSize(out, "\r"))
+ os.Stderr.WriteString(out)
LogMutex.Unlock()
}
}()