Problems with bash completion autocomplete (#2281)

refers #2280
This commit is contained in:
James Hodgkinson 2023-11-02 10:55:32 +10:00 committed by GitHub
parent dbf476fe5e
commit 85c2b0fd82
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 30 deletions

View file

@ -19,6 +19,10 @@ ${SUDOCMD} apt-get install -y \
git \
build-essential \
if [ -z "${PACKAGING}" ]; then
PACKAGING=0
fi
if [ "${PACKAGING}" -eq 1 ]; then
${SUDOCMD} apt-get install -y \
devscripts \

View file

@ -1,6 +1,7 @@
#![allow(dead_code)]
use std::env;
use std::io::Error;
use std::path::PathBuf;
use clap::{CommandFactory, Parser};
@ -11,11 +12,11 @@ use uuid::Uuid;
include!("src/opt/ssh_authorizedkeys.rs");
include!("src/opt/kanidm.rs");
fn main() {
fn main() -> Result<(), Error> {
profiles::apply_profile();
let outdir = match env::var_os("OUT_DIR") {
None => return,
None => return Ok(()),
Some(outdir) => outdir,
};
@ -29,33 +30,20 @@ fn main() {
std::fs::create_dir(&comp_dir).expect("Unable to create completions dir");
}
generate_to(
Shell::Bash,
&mut SshAuthorizedOpt::command(),
"kanidm_ssh_authorizedkeys_direct",
comp_dir.clone(),
)
.ok();
generate_to(
Shell::Zsh,
&mut SshAuthorizedOpt::command(),
"kanidm_ssh_authorizedkeys_direct",
comp_dir.clone(),
)
.ok();
for shell in [Shell::Bash, Shell::Zsh] {
generate_to(
shell,
&mut SshAuthorizedOpt::command(),
"kanidm_ssh_authorizedkeys_direct",
comp_dir.clone(),
)?;
generate_to(
Shell::Bash,
&mut KanidmClientParser::command(),
"kanidm",
comp_dir.clone(),
)
.ok();
generate_to(
Shell::Zsh,
&mut KanidmClientParser::command(),
"kanidm",
comp_dir,
)
.ok();
generate_to(
shell,
&mut KanidmClientParser::command(),
"kanidm",
comp_dir.clone(),
)?;
}
Ok(())
}