add bool flag and gen documentation

This commit is contained in:
Richard Guan 2023-01-16 16:14:19 +11:00
parent bb800fd78d
commit fc82aab74b
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)