Skip to content

Commit 9110e7b

Browse files
committed
completion
1 parent 16697bf commit 9110e7b

3 files changed

Lines changed: 25 additions & 0 deletions

File tree

src/commands/completion.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
use crate::utils::config::Config;
2+
3+
use super::*;
4+
5+
use clap::CommandFactory;
6+
use clap_complete::{generate, Shell};
7+
use std::io;
8+
9+
/// Generate completion script
10+
#[derive(Parser)]
11+
pub struct Args {
12+
shell: Shell,
13+
}
14+
15+
pub async fn command(args: Args, _config: Config) -> Result<()> {
16+
generate(
17+
args.shell,
18+
&mut self::Args::command(),
19+
"envx",
20+
&mut io::stdout(),
21+
);
22+
Ok(())
23+
}

src/commands/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ pub mod upload;
2626
pub mod variables;
2727
pub mod version;
2828
pub mod whoami;
29+
pub mod completion;

src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ pub struct Args {
3131
// Specify the modules you want to include in the commands_enum! macro
3232
commands_enum!(
3333
auth,
34+
completion,
3435
export,
3536
gen,
3637
import,

0 commit comments

Comments
 (0)