Documentation
¶
Overview ¶
Package cli implements span's command line: one binary, one cobra command per verb.
span used to install one executable per tool (span-import, span-tag, ...). The old names survive as symlinks to the single "span" binary. It looks at the name it was invoked under and runs the matching verb, so existing scripts, cron jobs and siskin tasks keep working unchanged.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dispatch ¶
Dispatch maps an invocation under a legacy name onto the command path that replaces it. argv is the whole command line, argv[0] included; it returns the args for the root command and whether a legacy name was used.
func RewriteArgs ¶
RewriteArgs bridges the stdlib flag package the legacy tools used and the pflag package cobra uses. With stdlib flags, "-unfreeze f" and "--unfreeze f" are the same thing, and so are "-o x" and "--o x". pflag reads "-unfreeze" as a cluster of shorthands and knows single letters only as shorthands, so long names get a second dash and single letters lose one.
Under a legacy name every single-dash multi-letter token is rewritten, since the stdlib flag package had no clusters. Under "span" itself only known flags are rewritten, so that clusters like "-bf" keep working.
Types ¶
This section is empty.