Skip to content

feat: add flag aliases support to autocomplete completions#1089

Open
khaled4vokalz wants to merge 1 commit intooclif:mainfrom
khaled4vokalz:feature/autocomplete-flag-aliases
Open

feat: add flag aliases support to autocomplete completions#1089
khaled4vokalz wants to merge 1 commit intooclif:mainfrom
khaled4vokalz:feature/autocomplete-flag-aliases

Conversation

@khaled4vokalz
Copy link

What

Flag definitions can include an aliases array property that allows alternative names for the same flag (e.g., --no-progress and --noProgress). Previously, only the primary flag name was included in generated autocomplete scripts.

This change ensures flag aliases are included in the completion output for all supported shells:

  • zsh: aliases added to _arguments block
  • bash: aliases added to the commands list
  • powershell: aliases added to the flags hashtable

Example output from a dummy cli:

$ my-cli app result -<TAB>
--bump-dev-version     --bumpDevVersion           -- Bump dev version before building.
--help                                            -- Show help for command
--no-progress          --noProgress               -- Don't display any progress indicators
--path                 -p                         -- The root directory of the app

Closes #1088

Flag definitions can include an `aliases` array property that allows
alternative names for the same flag (e.g., --no-progress and --noProgress).
Previously, only the primary flag name was included in generated
autocomplete scripts.

This change ensures flag aliases are included in the completion output
for all supported shells:
- zsh: aliases added to _arguments block
- bash: aliases added to the commands list
- powershell: aliases added to the flags hashtable

Example output from a dummy cli:

```bash
$ my-cli app result -<TAB>
--bump-dev-version     --bumpDevVersion           -- Bump dev version before building.
--help                                            -- Show help for command
--no-progress          --noProgress               -- Don't display any progress indicators
--path                 -p                         -- The root directory of the app
```

Closes oclif#1088
@salesforce-cla
Copy link

Thanks for the contribution! Before we can merge this, we need @khaled4vokalz to sign the Salesforce Inc. Contributor License Agreement.

@khaled4vokalz
Copy link
Author

Thanks for the contribution! Before we can merge this, we need @khaled4vokalz to sign the Salesforce Inc. Contributor License Agreement.

done

@khaled4vokalz
Copy link
Author

@cristiand391 , any plans with this? Sorry for the push, but It'd be really helpful for some of our use-case we're using oclif for...

@sergei-dyshel
Copy link

This CR duplicates some code and also doesn't take charAliases into account.
I prototyped a simpler solution here sergei-dyshel@7166e9b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support showing flag aliases in the auto complete output

2 participants