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 \ git \
build-essential \ build-essential \
if [ -z "${PACKAGING}" ]; then
PACKAGING=0
fi
if [ "${PACKAGING}" -eq 1 ]; then if [ "${PACKAGING}" -eq 1 ]; then
${SUDOCMD} apt-get install -y \ ${SUDOCMD} apt-get install -y \
devscripts \ devscripts \

View file

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