flags : more common help functions, but redefining the subcmds in each package is probably wrong, esp. since last had to be deduped

This commit is contained in:
bth 2026-01-20 13:10:47 -08:00
commit 77e3e23446
5 changed files with 31 additions and 14 deletions

View file

@ -6,6 +6,8 @@ import (
"github.com/brtholomy/um/go/flags"
)
const cmd = "tag"
type options struct {
Query flags.Arg
Date flags.Flag[string]
@ -38,10 +40,10 @@ func parseArgs(args []string) options {
case arg == opts.Date.Long || arg == opts.Date.Short:
i, opts.Date.Val = flags.ValidateIncrementFetchOrExit(args, i)
case arg == opts.Help.Long || arg == opts.Help.Short:
flags.Help("tag", opts)
flags.Help(cmd, opts)
default:
log.Printf("um tag: invalid argument: %s", arg)
flags.Help("tag", opts)
flags.HelpInvalidArg(cmd, arg)
flags.Help(cmd, opts)
}
}
return opts