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

Allow specifying subcommands via the poise::command macro #72

Closed
elkowar opened this issue May 7, 2022 · 1 comment
Closed

Allow specifying subcommands via the poise::command macro #72

elkowar opened this issue May 7, 2022 · 1 comment

Comments

@elkowar
Copy link
Contributor

elkowar commented May 7, 2022

Currently, specifying subcommands requires you to manually insert them into the Command struct, commonly done via

Command {
  subcommands: vec![a(), b(), c()],
  ..foo()
}

which is quite cumbersome, especially if you're splitting up your commands into separate modules.

To improve this, I'd propose adding a subcommands attribute to the poise::command macro, which would allow specifying subcommands on the parent command like this:

#[poise::command(
  slash_command,
  subcommands(a, b, c)
]
pub fn foo(_: Context<'_>) -> Result<(), Error> {
  Ok(())
}
@kangalio
Copy link
Collaborator

kangalio commented May 7, 2022

b740663

@kangalio kangalio closed this as completed May 7, 2022
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

No branches or pull requests

2 participants