-
Notifications
You must be signed in to change notification settings - Fork 993
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
feat: initial support for command aliases #647
Conversation
{text: command[0], padding: [0, 2, 0, 2], width: maxWidth(commands, theWrap) + 4}, | ||
{text: command[1]} | ||
) | ||
if (command[2] && command[2].length) { | ||
ui.div({text: '[' + __('aliases:') + ' ' + command[2].join(', ') + ']', padding: [0, 0, 0, 2], align: 'right'}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this implementation of aliases 👍 it's nice to see cliui
being dusted off.
@nexdrew for the locale files; feel free to open an issue and not let this block landing this feature. |
LGTM, nice work 👍 We should probably open a new issue to call for translations of |
Oh good point! Thanks @maxrimue, I'll do that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wonderful @nexdrew, I'm hoping to take on default commands tomorrow using this as a jumping off point.
Allows a command to have aliases if given as an array, e.g.
The first element in the array is treated as the canonical command, which supports positional args; the remaining elements are considered aliases. Aliases inherit their positional args from the canonical command and, thus, any positional args defined for an alias are ignored.
For example, all of the following are equivalent and only the
<name>
required positional arg will be parsed/validated:For help text, command aliases are displayed in a new right-aligned column after the canonical command and description, e.g.
TODO:
AddWill create a new issue for this"aliases:"
to all locales