intermodal/src/subcommand.rs
Casey Rodarmor 8c30205b02
Add shell completion scripts
Shell completion scripts can be generated for `bash`, `elvish`, `fish`,
`powershell`, and `zsh` with the `completions` subcommand:

    $ imdl completions --shell zsh > imdl.zsh

The same scripts are available in the `completions` directory. Please
refer to your shell's documentation for more information on how to
install and use completion scripts.

type: added
2020-04-07 19:01:37 -07:00

20 lines
428 B
Rust

use crate::common::*;
mod completions;
mod torrent;
#[derive(StructOpt)]
pub(crate) enum Subcommand {
Torrent(torrent::Torrent),
Completions(completions::Completions),
}
impl Subcommand {
pub(crate) fn run(self, env: &mut Env, options: &Options) -> Result<(), Error> {
match self {
Self::Torrent(torrent) => torrent.run(env, options),
Self::Completions(completions) => completions.run(env),
}
}
}