//! Argument stuffs use super::*; mod error; mod parse; pub fn program_name() -> &'static str { lazy_static!{ static ref NAME: String = std::env::args().next().unwrap(); } &NAME[..] } pub fn usage() -> ! { println!(r#"signing encryptor version {pkg_version} (format version {real_version}) by {authour} with <3 licensed with GPL v3 or later Usage: {program} [OPTIONS...] [-e|-d|-a] [-] [] Usage: {program} --generate RSA [--input ] [--password[=]] [--format BIN|TEXT|PEM] [] Usage: {program} --generate AES [--input ] [--password[=]] [--format BIN|TEXT] Usage: {program} --stat Usage: {program} --help - Stop reading argument flags: -e Encryption mode -d Decryption mode -a Autodetect mode (default) OPTIONS: -t Process to (autodetect mode) -te Process to (encryption mode) -td Process to (decryption mode) -i Process in-place for non-specific files (i.e. do not add or remove `.rae` file extension) -k Use this key (autodetect type) -kR Use this key (rsa private) -kr Use this key (rsa public) -ka Use this key (aes) Other options for `-k` -p Read a password from stdin for this key -P The next argument after the key file is a password for the key -s This key is also a signing key -S This key is only a signing key EXAMPLE: {program} -kRP key.rsa "super secret password" -ka key.aes -te input_file output_encrypted file "#, pkg_version = env!("CARGO_PKG_VERSION"), real_version = CURRENT_VERSION, authour = env!("CARGO_PKG_AUTHORS"), program = program_name()); std::process::exit(1) } #[instrument] /// Parse the program args into `Operation`. pub async fn parse_args() -> Result { parse::parse(std::env::args().skip(1)) .with_suggestion(|| "Try passing `--help`") }