Skip to content

Add --generate-completion flag for single-command apps and fix zsh completion#97

Merged
floitsch merged 1 commit intomainfrom
floitsch/simple-completion
Apr 6, 2026
Merged

Add --generate-completion flag for single-command apps and fix zsh completion#97
floitsch merged 1 commit intomainfrom
floitsch/simple-completion

Conversation

@floitsch
Copy link
Copy Markdown
Member

@floitsch floitsch commented Apr 6, 2026

For commands with a run callback (and thus no subcommands), a "completion" subcommand cannot be auto-added. Fall back to a "--generate-completion " option on the root command instead, gated on the existing --add-completion flag.

Fix zsh extension-filtered completion: replace parenthesized glob patterns like "(.toml|.yaml)" with one "_files -g" call per extension, since grouped patterns break _path_files directory-prefix navigation.

Register completion bindings for the basename, the program-path as given, and a "./" prefixed variant for relative paths, so that completion works regardless of how the binary is invoked.

Add examples/comp.toit demonstrating OptionPath with --extensions.

…mpletion.

For commands with a run callback (and thus no subcommands), a
"completion" subcommand cannot be auto-added. Fall back to a
"--generate-completion <shell>" option on the root command instead,
gated on the existing --add-completion flag.

Fix zsh extension-filtered completion: replace parenthesized glob
patterns like "(*.toml|*.yaml)" with one "_files -g" call per
extension, since grouped patterns break _path_files directory-prefix
navigation.

Register completion bindings for the basename, the program-path as
given, and a "./" prefixed variant for relative paths, so that
completion works regardless of how the binary is invoked.

Add examples/comp.toit demonstrating OptionPath with --extensions.
@floitsch floitsch requested a review from kasperl April 6, 2026 12:16
@floitsch
Copy link
Copy Markdown
Member Author

floitsch commented Apr 6, 2026

TBR.

@floitsch floitsch merged commit 7323833 into main Apr 6, 2026
7 checks passed
@floitsch floitsch deleted the floitsch/simple-completion branch April 6, 2026 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant