Add helper function for adding command to Commands
This commit is contained in:
parent
191edc648d
commit
270a2b48d9
1 changed files with 7 additions and 0 deletions
|
|
@ -153,6 +153,13 @@ pub trait CommandExt: Sized {
|
||||||
fn clap(self) -> clap::Clap<Self> {
|
fn clap(self) -> clap::Clap<Self> {
|
||||||
clap::Clap(self)
|
clap::Clap(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn add_to<E>(self, commands: &mut Commands<E>)
|
||||||
|
where
|
||||||
|
Self: Command<E> + Send + Sync + 'static,
|
||||||
|
{
|
||||||
|
commands.add(self);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sadly this doesn't work: `impl<E, C: Command<E>> CommandExt for C {}`
|
// Sadly this doesn't work: `impl<E, C: Command<E>> CommandExt for C {}`
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue