Now that refs complete after ref-taking commands (#94), the other half of the gap
is per-command flags. Past the subcommand, the scripts only ever offer the five
shared flags (-q --quiet --json --dry-run --help), so command-specific flags
like restore --clean, diff --stat/--name-only, find --ids, save -n, or
gc --keep never show up on tab.
Idea: build a small map of subcommand -> its flags off the argparse parser (walk
each subparser's _actions for the option strings, like _subcommands() already
walks the choices), inject it into the completion templates, and when the current
word starts with - offer that command's flags plus the shared ones instead of
just the shared five.
Scope stays in cli.py: one helper next to _subcommands() and the dash branch
of each of the four shell blocks in cmd_completion. Refs and file fallback stay
as they are.
Now that refs complete after ref-taking commands (#94), the other half of the gap
is per-command flags. Past the subcommand, the scripts only ever offer the five
shared flags (
-q --quiet --json --dry-run --help), so command-specific flagslike
restore --clean,diff --stat/--name-only,find --ids,save -n, orgc --keepnever show up on tab.Idea: build a small map of subcommand -> its flags off the argparse parser (walk
each subparser's
_actionsfor the option strings, like_subcommands()alreadywalks the choices), inject it into the completion templates, and when the current
word starts with
-offer that command's flags plus the shared ones instead ofjust the shared five.
Scope stays in
cli.py: one helper next to_subcommands()and the dash branchof each of the four shell blocks in
cmd_completion. Refs and file fallback stayas they are.