Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: copy the description of the option to its alias in completion #2269

Merged
merged 5 commits into from Dec 28, 2022
Merged

fix: copy the description of the option to its alias in completion #2269

merged 5 commits into from Dec 28, 2022

Conversation

tasshi-me
Copy link
Contributor

This PR fixes #2268.
I find the original option for the alias and copy its description to the alias.
As a result, the option and its alias are collected together and aligned in the completion.

@@ -258,7 +258,9 @@ export class Completion implements CompletionInstance {
if (!this.zshShell) {
completions.push(dashes + key);
} else {
const desc = descs[key] || '';
const aliasKey = this?.aliases?.[key]?.[0];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about cases where there are multiple aliases associated with a key? should this be a loop?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, Thank you. Yes, sometimes the this?.aliases?.[key]?.[0] will be another alias without a description.
I will make it a loop.

@tasshi-me tasshi-me requested a review from bcoe December 1, 2022 06:58
@tasshi-me
Copy link
Contributor Author

@bcoe
Thank you.
Can I ask you for the review again?

@bcoe bcoe merged commit f37ee6f into yargs:main Dec 28, 2022
@bcoe
Copy link
Member

bcoe commented Dec 28, 2022

@mshrtsr thank you for the contribution 👌

@tasshi-me tasshi-me deleted the fix/add-description-of-alias-on-zsh-completion branch December 29, 2022 04:34
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.

The completion for zsh does not align the option and its alias.
2 participants