Skip to content

complete per-command flags in the shell completions #96

Description

@qorexdevs

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions