mirror of
https://github.com/kanidm/kanidm.git
synced 2025-02-23 20:47:01 +01:00
Fixes #306 adding command line autocompletion. These are generated to: CARGO_TARGET_DIR/item-hash/out/. These will need to be packaged for distros later, it's unclear how we could use cargo install with these as cargo doesn't support arbitrary artefacts like this (yet?).
45 lines
1.2 KiB
Rust
45 lines
1.2 KiB
Rust
use std::env;
|
|
|
|
use structopt::clap::Shell;
|
|
use structopt::StructOpt;
|
|
|
|
include!("src/opt/ssh_authorizedkeys.rs");
|
|
include!("src/opt/cache_invalidate.rs");
|
|
include!("src/opt/cache_clear.rs");
|
|
include!("src/opt/unixd_status.rs");
|
|
|
|
fn main() {
|
|
let outdir = match env::var_os("OUT_DIR") {
|
|
None => return,
|
|
Some(outdir) => outdir,
|
|
};
|
|
|
|
SshAuthorizedOpt::clap().gen_completions(
|
|
"kanidm_ssh_authorizedkeys",
|
|
Shell::Bash,
|
|
outdir.clone(),
|
|
);
|
|
SshAuthorizedOpt::clap().gen_completions(
|
|
"kanidm_ssh_authorizedkeys",
|
|
Shell::Zsh,
|
|
outdir.clone(),
|
|
);
|
|
|
|
CacheInvalidateOpt::clap().gen_completions(
|
|
"kanidm_cache_invalidate",
|
|
Shell::Bash,
|
|
outdir.clone(),
|
|
);
|
|
CacheInvalidateOpt::clap().gen_completions(
|
|
"kanidm_cache_invalidate",
|
|
Shell::Zsh,
|
|
outdir.clone(),
|
|
);
|
|
|
|
CacheClearOpt::clap().gen_completions("kanidm_cache_clear", Shell::Bash, outdir.clone());
|
|
CacheClearOpt::clap().gen_completions("kanidm_cache_clear", Shell::Zsh, outdir.clone());
|
|
|
|
UnixdStatusOpt::clap().gen_completions("kanidm_unixd_status", Shell::Bash, outdir.clone());
|
|
UnixdStatusOpt::clap().gen_completions("kanidm_unixd_status", Shell::Zsh, outdir);
|
|
}
|