Merge pull request #10022 from FlattestWhite/richard/color-flag

feat: lotus-cli: Add global color flag
This commit is contained in:
Geoff Stuart 2023-01-16 10:15:12 -05:00 committed by GitHub
commit 00a73fd88f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View File

@ -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"
@ -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)
}
@ -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"},

View File

@ -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)