use anyhow::Result; use gumdrop::Options; use std::env; /// Represents command-line parameters. #[derive(Debug, Options)] pub struct Cli { #[options(help = "print help message and exit")] pub help: bool, #[options(help = "show debug output")] pub debug: bool, #[options( help = "folder name to use to search for SSH keys", default = "ssh-agent" )] pub folder: String, #[options( help = "custom field name where the private key filename is stored", meta = "NAME", default = "private" )] pub key: String, #[options( help = "custom field name where the key passphrase is stored", meta = "PASS", default = "passphrase" )] pub passphrase: String, #[options(help = "session to use to log in to bitwarden-cli")] pub session: String, #[options(help = "print version information and exit")] pub version: bool, } /// Retrieves the version information in the form of `PKG_NAME` - `PKG_VERSION`. pub fn get_version_string() -> Result { let name = env!("CARGO_PKG_NAME"); let version = env!("CARGO_PKG_VERSION"); return Ok(format!("{} {}", name, version)); }