diff --git a/src/config.rs b/src/config.rs index 633b0fe..4294086 100644 --- a/src/config.rs +++ b/src/config.rs @@ -6,15 +6,57 @@ use std::{fs, path::PathBuf, time::Duration}; #[allow(clippy::module_name_repetitions)] #[derive(ClapSerde, Serialize, Deserialize, Debug, PartialEq, Eq)] pub struct Config { + /// The X display to use for the dialog. + #[arg(short = 'D', long, env = "PINENTRY_DISPLAY", value_name = "DISPLAY")] + pub display: Option, + + /// The tty terminal node name + #[arg(short = 'T', long, env = "TTYNAME", value_name = "FILE")] + pub ttyname: Option, + + // The tty terminal type + #[arg(short = 'N', long, env = "TTYTYPE", value_name = "NAME")] + pub ttytype: Option, + + /// The `LC_CTYPE` locale category. + #[arg(short = 'C', long, env = "LC_CTYPE", value_name = "STRING")] + pub lc_ctype: Option, + + /// The `LC_MESSAGES` value. + #[arg(short = 'M', long, env = "LC_MESSAGES", value_name = "STRING")] + pub lc_messages: Option, + /// Timeout in seconds for requests that show dialogs to the user. /// E.g. GETPIN, CONFIRM, etc. - #[arg(short, long, value_name = "TIMEOUT_IN_SECONDS", value_parser = parse_duration, default_value = "300")] - pub timeout_in_seconds: Option, + #[arg( + short = 'o', + long, + env = "ELEPHANTINE_TIMEOUT", + value_name = "SECS", + value_parser = parse_duration, + default_value = "300", + )] + pub timeout: Option, + + /// Grab keyboard only while the window is focused. + #[arg(short = 'g', long, env = "ELEPHANTINE_NO_LOCAL_GRAB")] + pub no_local_grab: bool, + + /// Parent window ID (for partitioning). + #[arg(short = 'W', long, value_name = "WINDOW_ID")] + pub parent_wid: Option, + + /// Custom colors for the dialog. + #[arg(short = 'c', long, value_name = "STRING")] + pub colors: Option, + + /// The alert mode (none, beep, or flash). + #[arg(short = 'a', long, value_name = "STRING")] + pub ttyalert: Option, - /// The command to run when a user input is required. + /// The command to run the dialog. /// It must print the input to stdout. #[arg( - short, long, value_name = "COMMAND", value_delimiter = ' ', diff --git a/src/lib.rs b/src/lib.rs index 00d75b7..a2ed522 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -297,7 +297,7 @@ mod test { let mut output = std::io::Cursor::new(vec![]); let mut listener = Listener::new(Config { - timeout_in_seconds: None, + timeout: None, command: vec!["echo", "-n", "1234"] .into_iter() .map(std::string::ToString::to_string)