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?).
38 lines
1,016 B
Rust
38 lines
1,016 B
Rust
use std::env;
|
|
use std::path::PathBuf;
|
|
|
|
use structopt::clap::Shell;
|
|
use structopt::StructOpt;
|
|
|
|
include!("src/opt/ssh_authorizedkeys.rs");
|
|
include!("src/opt/badlist_preprocess.rs");
|
|
include!("src/opt/kanidm.rs");
|
|
|
|
fn main() {
|
|
let outdir = match env::var_os("OUT_DIR") {
|
|
None => return,
|
|
Some(outdir) => outdir,
|
|
};
|
|
|
|
SshAuthorizedOpt::clap().gen_completions(
|
|
"kanidm_ssh_authorizedkeys_direct",
|
|
Shell::Bash,
|
|
outdir.clone(),
|
|
);
|
|
SshAuthorizedOpt::clap().gen_completions(
|
|
"kanidm_ssh_authorizedkeys_direct",
|
|
Shell::Zsh,
|
|
outdir.clone(),
|
|
);
|
|
|
|
BadlistProcOpt::clap().gen_completions(
|
|
"kanidm_badlist_preprocess",
|
|
Shell::Bash,
|
|
outdir.clone(),
|
|
);
|
|
BadlistProcOpt::clap().gen_completions("kanidm_badlist_preprocess", Shell::Zsh, outdir.clone());
|
|
|
|
KanidmClientOpt::clap().gen_completions("kanidm", Shell::Bash, outdir.clone());
|
|
KanidmClientOpt::clap().gen_completions("kanidm", Shell::Zsh, outdir);
|
|
}
|