mirror of
https://github.com/kanidm/kanidm.git
synced 2025-02-23 12:37:00 +01:00
Yaleman/issue989 (#2111)
* adding version command to ssh_authorizedkys * adding version and help to kanidm_unixd_tasks
This commit is contained in:
parent
d5ed335b52
commit
a239fbdd94
|
@ -1,4 +1,5 @@
|
|||
#[derive(Debug, Parser)]
|
||||
#[command(version)]
|
||||
struct SshAuthorizedOpt {
|
||||
#[clap(short, long = "debug")]
|
||||
debug: bool,
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#[derive(Debug, Parser)]
|
||||
#[command(name="kanidm_ssh_authorizedkeys")]
|
||||
#[command(name = "kanidm_ssh_authorizedkeys")]
|
||||
struct SshAuthorizedOpt {
|
||||
#[clap(short, long)]
|
||||
debug: bool,
|
||||
#[clap()]
|
||||
account_id: String,
|
||||
account_id: Option<String>,
|
||||
#[clap(short, long, action = clap::ArgAction::SetTrue)]
|
||||
version: bool,
|
||||
}
|
||||
|
|
|
@ -34,8 +34,14 @@ async fn main() -> ExitCode {
|
|||
println!("ssh_authorizedkeys {}", env!("KANIDM_PKG_VERSION"));
|
||||
return ExitCode::SUCCESS;
|
||||
}
|
||||
|
||||
sketching::tracing_subscriber::fmt::init();
|
||||
|
||||
if opt.account_id.is_none() {
|
||||
error!("No account specified, quitting!");
|
||||
return ExitCode::FAILURE;
|
||||
}
|
||||
|
||||
debug!("Starting authorized keys tool ...");
|
||||
|
||||
let cfg = match KanidmUnixdConfig::new().read_options_from_optional_config(DEFAULT_CONFIG_PATH)
|
||||
|
@ -60,7 +66,8 @@ async fn main() -> ExitCode {
|
|||
);
|
||||
return ExitCode::FAILURE;
|
||||
}
|
||||
let req = ClientRequest::SshKey(opt.account_id);
|
||||
// safe because we've already thrown an error if it's not there
|
||||
let req = ClientRequest::SshKey(opt.account_id.unwrap_or("".to_string()));
|
||||
|
||||
match call_daemon(cfg.sock_path.as_str(), req, cfg.unix_sock_timeout).await {
|
||||
Ok(r) => match r {
|
||||
|
|
|
@ -267,6 +267,19 @@ async fn main() -> ExitCode {
|
|||
let ceuid = get_effective_uid();
|
||||
let cegid = get_effective_gid();
|
||||
|
||||
for arg in std::env::args() {
|
||||
if arg.contains("--version") {
|
||||
println!("kanidm_unixd_tasks {}", env!("CARGO_PKG_VERSION"));
|
||||
return ExitCode::SUCCESS;
|
||||
} else if arg.contains("--help") {
|
||||
println!("kanidm_unixd_tasks {}", env!("CARGO_PKG_VERSION"));
|
||||
println!("Usage: kanidm_unixd_tasks");
|
||||
println!(" --version");
|
||||
println!(" --help");
|
||||
return ExitCode::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::expect_used)]
|
||||
tracing_forest::worker_task()
|
||||
.set_global(true)
|
||||
|
|
Loading…
Reference in a new issue