2 goredo -- redo implementation on pure Go
3 Copyright (C) 2020-2021 Sergey Matveev <stargrave@stargrave.org>
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, version 3 of the License.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
27 EnvStatusFd = "REDO_STATUS_FD"
28 EnvNoStatus = "REDO_NO_STATUS"
39 flagNoStatus = flag.Bool("no-status", false, "disable statusline (REDO_NO_STATUS=1)")
43 if NoProgress || *flagNoStatus {
46 if v := os.Getenv(EnvNoStatus); v == "1" {
49 if v := os.Getenv(EnvStatusFd); v != "" {
53 FdStatus = mustParseFd(v, EnvStatusFd)
58 r, FdStatus, err = os.Pipe()
67 buf := make([]byte, 1)
71 if err != nil || n != 1 {
87 "\rrun: %d wait: %d done: %d",
88 running, waiting, done,
92 "\rrun: %s%d%s wait: %s%d%s done: %s%d%s",
93 CRedo, running, CReset,
94 CWait, waiting, CReset,
99 os.Stderr.WriteString(fillUpToTermSize(out, "\r"))