- Notifications
You must be signed in to change notification settings - Fork 349
Description
Zsh completions are not shown for arguments that are added to a command using an @OptionGroup
and that have a custom
completion kind.
ArgumentParser version: main
Swift version:
swift-driver version: 1.90.11.1 Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4) Target: arm64-apple-macosx14.0
Checklist
- If possible, I've reproduced the issue using the
main
branch of this package - I've searched for existing GitHub issues
Steps to Reproduce
-
Create a command with an option group with an arguments with a custom completion kind.
import ArgumentParser struct ArgOptionGroup: ParsableArguments { @Argument(completion: .custom { _ in ["1-argInOptionGroup", "2-argInOptionGroup", "3-argInOptionGroup"] }) var argInOptionGroup: String } @main struct CompletionExample: ParsableCommand { @Argument(completion: .custom { _ in ["1-argInCommand", "2-argInCommand", "3-argInCommand"] }) var argInCommand: String @OptionGroup var optionGroup: ArgOptionGroup }
-
Install the completions in your terminal and load them, steps will vary per environment, for me the steps are.
swift build
- Install the completions.
./completion-example --generate-completion-script zsh > ~/.oh-my-zsh/completions/_completion-example
- Open a new terminal to load the new completions.
-
Press tab to accept the first completion
Expected behavior
It should suggest completions for the argument from the option group, as it did for the argument in the command (step 3).
Actual behavior
It doesn't show any completions for the arguments in the option group (step 4). When starting to type any of the options that should be suggested (step 5), it prints that there are no matches (probably from zsh-autosuggestions
).