Order options in help message

This commit is contained in:
Matéo Duparc 2021-06-30 15:24:56 +02:00
parent 7cf87d5fa4
commit 2fc56b6e6e
Signed by: hardcoresushi
GPG Key ID: 007F84120107191E

View File

@ -23,6 +23,7 @@ pub fn parse() -> Option<CliArgs> {
let app = App::new(crate_name!()) let app = App::new(crate_name!())
.version(crate_version!()) .version(crate_version!())
.setting(AppSettings::ColoredHelp) .setting(AppSettings::ColoredHelp)
.about("Secure symmetric encryption from the command line.")
.arg(Arg::with_name("INPUT").help("<PATH> | \"-\" or empty for stdin")) .arg(Arg::with_name("INPUT").help("<PATH> | \"-\" or empty for stdin"))
.arg(Arg::with_name("OUTPUT").help("<PATH> | \"-\" or empty for stdout")) .arg(Arg::with_name("OUTPUT").help("<PATH> | \"-\" or empty for stdout"))
.arg( .arg(
@ -32,14 +33,14 @@ pub fn parse() -> Option<CliArgs> {
.help(&format!("Encrypt even if {} format is recognized", crate_name!())) .help(&format!("Encrypt even if {} format is recognized", crate_name!()))
) )
.arg( .arg(
Arg::with_name("password") Arg::with_name("1_password")
.short("p") .short("p")
.long("password") .long("password")
.value_name("password") .value_name("password")
.help("Password used to derive encryption keys") .help("Password used to derive encryption keys")
) )
.arg( .arg(
Arg::with_name("t_cost") Arg::with_name("2_t_cost")
.short("i") .short("i")
.long("iterations") .long("iterations")
.value_name("iterations") .value_name("iterations")
@ -47,7 +48,7 @@ pub fn parse() -> Option<CliArgs> {
.default_value("10") .default_value("10")
) )
.arg( .arg(
Arg::with_name("m_cost") Arg::with_name("3_m_cost")
.short("m") .short("m")
.long("memory-cost") .long("memory-cost")
.value_name("memory cost") .value_name("memory cost")
@ -55,7 +56,7 @@ pub fn parse() -> Option<CliArgs> {
.default_value("4096") .default_value("4096")
) )
.arg( .arg(
Arg::with_name("parallelism") Arg::with_name("4_parallelism")
.short("t") .short("t")
.long("threads") .long("threads")
.value_name("threads") .value_name("threads")
@ -82,9 +83,9 @@ pub fn parse() -> Option<CliArgs> {
.get_matches(); .get_matches();
let params = { let params = {
let t_cost = number(app.value_of("t_cost").unwrap())?; let t_cost = number(app.value_of("2_t_cost").unwrap())?;
let m_cost = number(app.value_of("m_cost").unwrap())?; let m_cost = number(app.value_of("3_m_cost").unwrap())?;
let parallelism = number(app.value_of("parallelism").unwrap())?; let parallelism = number(app.value_of("4_parallelism").unwrap())?;
ArgonParams { ArgonParams {
t_cost, t_cost,
@ -129,7 +130,7 @@ pub fn parse() -> Option<CliArgs> {
}) })
.unwrap_or_else(|| Some(Box::new(stdout())))?; .unwrap_or_else(|| Some(Box::new(stdout())))?;
let password = match app.value_of("password") { let password = match app.value_of("1_password") {
Some(s) => s.to_string(), Some(s) => s.to_string(),
None => rpassword::read_password_from_tty(Some("Password: ")).unwrap(), None => rpassword::read_password_from_tty(Some("Password: ")).unwrap(),
}; };