diff options
Diffstat (limited to 'cmd/krino/main.go')
| -rw-r--r-- | cmd/krino/main.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/cmd/krino/main.go b/cmd/krino/main.go index f5fdfea..12fdf5f 100644 --- a/cmd/krino/main.go +++ b/cmd/krino/main.go @@ -50,6 +50,7 @@ Sort the files in the directories listed in krino.conf by their rules. -v also list unmatched, ignored and busy files --json with -n: print the plan as JSON -c FILE use FILE instead of ~/.config/krino/krino.conf + --no-color never colour the output, as when NO_COLOR is set -h, --help show this help --version print the version ` @@ -57,6 +58,7 @@ Sort the files in the directories listed in krino.conf by their rules. // globals holds the flags that may appear before or after a subcommand. type globals struct { yes, dry, verbose, json bool + noColor bool conf string } @@ -108,11 +110,14 @@ func run(args []string, stdout, stderr io.Writer) int { return cmdSort(g, rest, stdout, stderr) } -// flagSet returns a silent flag set with -c bound to g, shared by every command. +// flagSet returns a silent flag set with -c and --no-color bound to g, +// shared by every command. Each defaults to the value already parsed, so a +// flag given before a subcommand survives the subcommand's own flag set. func flagSet(name string, g *globals) *flag.FlagSet { fs := flag.NewFlagSet(name, flag.ContinueOnError) fs.SetOutput(io.Discard) fs.StringVar(&g.conf, "c", g.conf, "") + fs.BoolVar(&g.noColor, "no-color", g.noColor, "") return fs } |
