Merge pull request #10022 from FlattestWhite/richard/color-flag
feat: lotus-cli: Add global color flag
This commit is contained in:
commit
00a73fd88f
@ -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"},
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user