diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-09-14 13:26:51 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-09-14 13:26:51 +0200 |
| commit | 07c24054cab965800983ef40f53a05c2db131ede (patch) | |
| tree | 741db561d614b35f8f94fee04fb5ce663a629a0b /cmd/krino/main.go | |
| parent | 70dccf8d573028aaed64185acb8e134e5339afa3 (diff) | |
| download | krino-07c24054cab965800983ef40f53a05c2db131ede.tar.gz krino-07c24054cab965800983ef40f53a05c2db131ede.zip | |
krino: 0.0.3 — the plan as one block per file, wrapped, and -Pv0.0.3
Each file shows its steps, then the rule and the reason it matched, one
field per line; on a terminal every line wraps to its width with
continuation lines under their own column, and piped output is never
wrapped. Choosing per file shows the same block. -P / --no-pager prints
the plan without the pager. A duplicate's original is shown with ~.
Diffstat (limited to 'cmd/krino/main.go')
| -rw-r--r-- | cmd/krino/main.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/cmd/krino/main.go b/cmd/krino/main.go index 12fdf5f..6d1ef96 100644 --- a/cmd/krino/main.go +++ b/cmd/krino/main.go @@ -51,6 +51,7 @@ Sort the files in the directories listed in krino.conf by their rules. --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 + -P, --no-pager print the plan straight out, never through the pager -h, --help show this help --version print the version ` @@ -58,7 +59,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 + noColor, noPager bool conf string } @@ -110,14 +111,17 @@ func run(args []string, stdout, stderr io.Writer) int { return cmdSort(g, rest, stdout, stderr) } -// 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. +// flagSet returns a silent flag set with -c, --no-color and -P/--no-pager +// 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, "") + fs.BoolVar(&g.noPager, "no-pager", g.noPager, "") + fs.BoolVar(&g.noPager, "P", g.noPager, "") return fs } |
