You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CLI: an option value such as --name -g is parsed as the mode flag #422
Found while reviewing #421; pre-existing argument parsing shared by several commands, not changed there.
Problem
skillshare link <path> --name <value> (and other commands that go through parseModeArgs first, see loadLinkScope in cmd/skillshare/link.go) run the mode-flag parser over the whole argument list before the command parses its own options. A --name value that looks like a mode flag is therefore consumed as the mode:
skillshare link ~/code/dev-skills --name -g
# -g is taken as "global mode"; --name is left without a value (or takes the next argument)
The same happens for -p. -- only protects arguments after it, so --name -- -g does not help either because --name then has no value.
Expected
A value that follows --name (or any option that takes a value) is never interpreted as a mode flag. Either parseModeArgs must skip the value slot of value-taking options, or commands must parse their own options before extracting the mode flags.
any other command that calls parseModeArgs on the raw argument list before its own option loop (rg -n "parseModeArgs(" cmd/skillshare)
Acceptance
skillshare link <path> --name -g creates a link named -g in the mode chosen by the real mode flag (or auto mode), and skillshare unlink -- -g removes it.
Activity
fix(link): show help before loading the scope and accept -g/-p as --n…