8c30205b02
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
20 lines
428 B
Rust
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),
|
|
}
|
|
}
|
|
}
|