Skip to content

feat: allow unambiguous command shorthands - #649

Open
dtor wants to merge 1 commit into
stacked-git:masterfrom
dtor:allow-shorthands
Open

dtor wants to merge 1 commit into
stacked-git:masterfrom
dtor:allow-shorthands

Conversation

@dtor

@dtor dtor commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

Allow invoking StGit commands, aliases, and subcommands using any unambiguous prefix (for example, stg del for stg delete, stg ser for stg series, or stg em s for stg email send), matching StGit 1.x behavior.

Enable infer_subcommands(true) on the base clap Command so clap accepts unambiguous prefixes for top-level and nested subcommands. Because the initial bootstrap CLI parser uses
allow_external_subcommands(true) to avoid constructing the full command graph up front, also resolve subcommand prefixes across built-in commands, help, and configured aliases:

  • Exact matches on built-in commands, help, or aliases always take precedence over prefix matches.
  • Non-exact prefixes are checked against built-in commands, help, and aliases together so that a prefix shared between a built-in command and an alias (such as res for reset and resolved) is rejected as ambiguous.

Allow invoking StGit commands, aliases, and subcommands using any
unambiguous prefix (for example, `stg del` for `stg delete`, `stg ser`
for `stg series`, or `stg em s` for `stg email send`), matching StGit
1.x behavior.

Enable `infer_subcommands(true)` on the base clap Command so clap
accepts unambiguous prefixes for top-level and nested subcommands.
Because the initial bootstrap CLI parser uses
`allow_external_subcommands(true)` to avoid constructing the full
command graph up front, also resolve subcommand prefixes across
built-in commands, `help`, and configured aliases:

- Exact matches on built-in commands, `help`, or aliases always take
  precedence over prefix matches.
- Non-exact prefixes are checked against built-in commands, `help`,
  and aliases together so that a prefix shared between a built-in
  command and an alias (such as `res` for `reset` and `resolved`) is
  rejected as ambiguous.

Signed-off-by: Dmitry Torokhov <dtor@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant