Skip to content

feat(subcommand): support alias for subcommand #155

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

fu050409
Copy link

@fu050409 fu050409 commented Jul 5, 2024

Support alias for subCommand

Resolved: #152

@@ -90,6 +90,7 @@ export type SubCommandsDef = Record<string, Resolvable<CommandDef<any>>>;
export type CommandDef<T extends ArgsDef = ArgsDef> = {
meta?: Resolvable<CommandMeta>;
args?: Resolvable<T>;
alias?: Resolvable<string | string[]>;
Copy link
Member

Choose a reason for hiding this comment

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

minor nit, maybe this should actually be in a SubCommandDef

you can't alias the root command since it is the 'argless' execution afaict

so maybe SubCommandsDef should actually be Record<string, Resolvable<SubCommandDef<any>>>, where SubCommandDef is just CommandDef<T> & {alias?: Resolvable<string | string[]>}

what do you think?

Copy link
Author

Choose a reason for hiding this comment

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

Thank you for your review, this is an early PR, it took me some time to understand it.😂

I agree with you and I will try to revise it later.

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.

Create alias for subcommand
2 participants