diff --git a/pin-gen/Cargo.toml b/pin-gen/Cargo.toml index e82c942..58a7c52 100644 --- a/pin-gen/Cargo.toml +++ b/pin-gen/Cargo.toml @@ -16,7 +16,7 @@ sysexits = "0.7" argon2 = { version = "0.5", features = ["std"] } rand_core = { version = "0.6", features = ["std"] } rpassword = "7.3" -clap = { version = "3.2", features = ["derive"] } +clap = { version = "3.2", features = ["derive", "env"] } birdcage = { version = "0.3", optional = true } [features] diff --git a/pin-gen/src/cli.rs b/pin-gen/src/cli.rs index 5e3794f..079c94b 100644 --- a/pin-gen/src/cli.rs +++ b/pin-gen/src/cli.rs @@ -1,14 +1,19 @@ use crate::{Error, Result}; -use clap::Parser; +use clap::{Parser, ValueHint}; use error_stack::ResultExt; use std::path::PathBuf; #[derive(Parser, Debug, Clone)] #[clap(author, version, about)] pub struct CliArgs { - #[clap(short = 'f', long, default_value = "/etc/security/pins.toml")] + #[clap( + short = 'f', + long, + default_value = "/etc/security/pins.toml", + value_hint(ValueHint::FilePath) + )] pub database_filepath: PathBuf, - #[clap()] + #[clap(env = "SUDO_USER", value_hint(ValueHint::Username))] pub username: Option, /// Use this flag to try different parameters. /// It disables the need for a username and pin.