diff options
| author | JP Appel <jeanpierre.appel01@gmail.com> | 2026-09-18 21:30:46 -0400 |
|---|---|---|
| committer | JP Appel <jeanpierre.appel01@gmail.com> | 2026-09-18 21:30:46 -0400 |
| commit | bb8da8c11f29182eb7520602944be156611b73e5 (patch) | |
| tree | 79891d31922e27f13eab2f8ca3528d7e49c25d06 /cmd/index.go | |
| parent | 93d279ccd27d2ed881794a706ab3c7ccf59a2748 (diff) | |
Refactor flag parsing; start work on zsh completion
Diffstat (limited to 'cmd/index.go')
| -rw-r--r-- | cmd/index.go | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/cmd/index.go b/cmd/index.go index ba9bb8f..7fd63ab 100644 --- a/cmd/index.go +++ b/cmd/index.go @@ -19,7 +19,8 @@ type IndexFlags struct { index.ParseOpts } -func SetupIndexFlags(args []string, fs *flag.FlagSet, flags *IndexFlags) { +func NewIndexFlagSet(flags *IndexFlags) *flag.FlagSet { + fs := flag.NewFlagSet("index", flag.ExitOnError) flags.ParseLinks = true flags.ParseMeta = true flags.ParseHeadings = true @@ -65,14 +66,7 @@ func SetupIndexFlags(args []string, fs *flag.FlagSet, flags *IndexFlags) { PrintGlobalFlags(f) } - fs.Parse(args) - - remainingArgs := fs.Args() - if len(remainingArgs) == 0 { - flags.Subcommand = "build" - } else if len(remainingArgs) == 1 { - flags.Subcommand = remainingArgs[0] - } + return fs } func RunIndex(gFlags GlobalFlags, iFlags IndexFlags, db *data.Query) byte { |
