Skip to content

Commit

Permalink
Merge pull request #10022 from FlattestWhite/richard/color-flag
Browse files Browse the repository at this point in the history
feat: lotus-cli: Add global color flag
  • Loading branch information
geoff-vball authored Jan 16, 2023
2 parents bb800fd + fc82aab commit 00a73fd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cmd/lotus/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"os"

"github.com/fatih/color"
logging "github.com/ipfs/go-log/v2"
"github.com/mattn/go-isatty"
"github.com/urfave/cli/v2"
Expand Down Expand Up @@ -52,6 +53,10 @@ func main() {
}
jaeger = tracing.SetupJaegerTracing("lotus/" + cmd.Name)

if cctx.IsSet("color") {
color.NoColor = !cctx.Bool("color")
}

if originBefore != nil {
return originBefore(cctx)
}
Expand All @@ -75,6 +80,12 @@ func main() {
Hidden: true,
Value: "~/.lotus", // should follow --repo default
},
&cli.BoolFlag{
// examined in the Before above
Name: "color",
Usage: "use color in display output",
DefaultText: "depends on output being a TTY",
},
&cli.StringFlag{
Name: "repo",
EnvVars: []string{"LOTUS_PATH"},
Expand Down
1 change: 1 addition & 0 deletions documentation/en/cli-lotus.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ COMMANDS:
status Check node status
GLOBAL OPTIONS:
--color use color in display output (default: depends on output being a TTY)
--force-send if true, will ignore pre-send checks (default: false)
--help, -h show help (default: false)
--interactive setting to false will disable interactive functionality of commands (default: false)
Expand Down

0 comments on commit 00a73fd

Please # to comment.