apple / apple/swift-argument-parser
Requiring completion candidates configuration for all parameters
- Dominant language
- Swift
- Stars
- 3.8k
- Forks
- 411
- Avg merge
- 7d 14h
- Merged PRs (30d)
- 15
Description
There should be some way to require all property wrapper attributes (`@Argument`, etc.) to have a `completion:` argument if Swift Argument Parser cannot autogenerate shell completion candidates.
Some command-line parameters are unable to have completion candidates offered (like an account name, an unconstrained number, etc.), so a new `none` case for `CompletionKind.Kind` & an associated `CompletionKind.none` static property should be added.
If a shell's completion system can nicely indicate the type, name, or other info about a non-completable argument or option value, or even flat-out reject invalid values (like characters that aren't digits for an integer argument), then the completion scripts generated for that shell should properly configure those features.
This detection should be optional at build time (given it's a new feature, I assume the default should be to not perform such detection).
If detection at compile time proves too onerous or impossible to implement, then this detection could be performed when a `--strict` (or otherwise named) flag is included in the command line used to generate a completion script (using the `--generate-completion-script` flag).
Contributor guide
Research direction
Start by reading the completion-generation entry point for --generate-completion-script and the definitions of CompletionKind.Kind and CompletionKind.none. Determine whether optional detection belongs at build time or behind a --strict generation flag, then define how each shell should represent non-completable values and what generated scripts must do when the feature is enabled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100