Add `-h` flag to binaries
Signed-off-by: xphoniex <dj.2dixx@gmail.com>
This commit is contained in:
parent
0e54c4a293
commit
4869fe26e2
|
|
@ -48,7 +48,7 @@ impl Args for Options {
|
|||
|
||||
while let Some(arg) = parser.next()? {
|
||||
match arg {
|
||||
Long("help") => {
|
||||
Long("help") | Short('h') => {
|
||||
return Err(Error::Help.into());
|
||||
}
|
||||
Long("to") => {
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ impl Args for Options {
|
|||
Long("stdin") => {
|
||||
stdin = true;
|
||||
}
|
||||
Long("help") => {
|
||||
Long("help") | Short('h') => {
|
||||
return Err(Error::Help.into());
|
||||
}
|
||||
_ => return Err(anyhow::anyhow!(arg.unexpected())),
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ impl Args for Options {
|
|||
Long("no-confirm") => {
|
||||
// Ignored for now.
|
||||
}
|
||||
Long("help") => return Err(Error::Help.into()),
|
||||
Long("help") | Short('h') => return Err(Error::Help.into()),
|
||||
Long("remote") => {
|
||||
let val = parser.value().unwrap();
|
||||
remote = Some(term::args::did(&val)?);
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ impl Args for Options {
|
|||
Long("announce") => {
|
||||
announce = true;
|
||||
}
|
||||
Long("help") => {
|
||||
Long("help") | Short('h') => {
|
||||
return Err(Error::Help.into());
|
||||
}
|
||||
Value(val) if id.is_none() => {
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ impl Args for Options {
|
|||
}
|
||||
|
||||
// Common.
|
||||
Long("help") => return Err(Error::Help.into()),
|
||||
Long("help") | Short('h') => return Err(Error::Help.into()),
|
||||
|
||||
Value(val) if id.is_none() => {
|
||||
let val = string(&val);
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ impl Args for Options {
|
|||
|
||||
while let Some(arg) = parser.next()? {
|
||||
match arg {
|
||||
Long("help") => {
|
||||
Long("help") | Short('h') => {
|
||||
return Err(Error::Help.into());
|
||||
}
|
||||
Long("to") => {
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ impl Args for Options {
|
|||
|
||||
while let Some(arg) = parser.next()? {
|
||||
match arg {
|
||||
Long("help") => {
|
||||
Long("help") | Short('h') => {
|
||||
return Err(Error::Help.into());
|
||||
}
|
||||
Value(val) if id.is_none() => {
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ impl Args for Options {
|
|||
|
||||
if let Some(arg) = parser.next()? {
|
||||
match arg {
|
||||
Long("help") => {
|
||||
Long("help") | Short('h') => {
|
||||
return Err(Error::Help.into());
|
||||
}
|
||||
Value(val) if rid.is_none() => {
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ impl Args for Options {
|
|||
|
||||
if let Some(arg) = parser.next()? {
|
||||
match arg {
|
||||
Long("help") => {
|
||||
Long("help") | Short('h') => {
|
||||
return Err(Error::Help.into());
|
||||
}
|
||||
_ => return Err(anyhow::anyhow!(arg.unexpected())),
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ impl Args for Options {
|
|||
|
||||
while let Some(arg) = parser.next()? {
|
||||
match arg {
|
||||
Long("help") => {
|
||||
Long("help") | Short('h') => {
|
||||
return Err(Error::Help.into());
|
||||
}
|
||||
Long("title") if op == Some(OperationName::Edit) => {
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ impl Args for Options {
|
|||
Long("verbose") | Short('v') => {
|
||||
verbose = true;
|
||||
}
|
||||
Long("help") => {
|
||||
Long("help") | Short('h') => {
|
||||
return Err(Error::Help.into());
|
||||
}
|
||||
Value(val) if path.is_none() => {
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ impl Args for Options {
|
|||
|
||||
while let Some(arg) = parser.next()? {
|
||||
match arg {
|
||||
Long("help") => {
|
||||
Long("help") | Short('h') => {
|
||||
return Err(Error::Help.into());
|
||||
}
|
||||
Long("refs") => {
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ impl Args for Options {
|
|||
|
||||
while let Some(arg) = parser.next()? {
|
||||
match arg {
|
||||
Long("help") => {
|
||||
Long("help") | Short('h') => {
|
||||
return Err(Error::Help.into());
|
||||
}
|
||||
Long("all") if op.is_none() || op == Some(OperationName::List) => {
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ impl Args for Options {
|
|||
|
||||
if let Some(arg) = parser.next()? {
|
||||
match arg {
|
||||
Long("help") => {
|
||||
Long("help") | Short('h') => {
|
||||
return Err(Error::Help.into());
|
||||
}
|
||||
Long("verbose") | Short('v') => verbose = true,
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ impl Args for Options {
|
|||
|
||||
while let Some(arg) = parser.next()? {
|
||||
match arg {
|
||||
Long("help") => {
|
||||
Long("help") | Short('h') => {
|
||||
return Err(Error::Help.into());
|
||||
}
|
||||
Value(val) if op.is_none() => match val.to_string_lossy().as_ref() {
|
||||
|
|
|
|||
|
|
@ -251,7 +251,7 @@ impl Args for Options {
|
|||
Long("verbose") | Short('v') => {
|
||||
verbose = true;
|
||||
}
|
||||
Long("help") => {
|
||||
Long("help") | Short('h') => {
|
||||
return Err(Error::Help.into());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ impl Args for Options {
|
|||
#[allow(clippy::never_loop)]
|
||||
while let Some(arg) = parser.next()? {
|
||||
match arg {
|
||||
Long("help") => {
|
||||
Long("help") | Short('h') => {
|
||||
return Err(Error::Help.into());
|
||||
}
|
||||
_ => return Err(anyhow!(arg.unexpected())),
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ impl Args for Options {
|
|||
|
||||
while let Some(arg) = parser.next()? {
|
||||
match arg {
|
||||
Long("help") => {
|
||||
Long("help") | Short('h') => {
|
||||
return Err(args::Error::Help.into());
|
||||
}
|
||||
Long("name") | Short('n') => {
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ impl Args for Options {
|
|||
|
||||
while let Some(arg) = parser.next()? {
|
||||
match arg {
|
||||
Long("help") => {
|
||||
Long("help") | Short('h') => {
|
||||
return Err(Error::Help.into());
|
||||
}
|
||||
Long("revision") | Short('r') => {
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ impl Args for Options {
|
|||
Long("no-confirm") => {
|
||||
confirm = false;
|
||||
}
|
||||
Long("help") => {
|
||||
Long("help") | Short('h') => {
|
||||
return Err(Error::Help.into());
|
||||
}
|
||||
Value(val) if id.is_none() => {
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ impl Args for Options {
|
|||
Long("ssh-fingerprint") if show.is_none() => {
|
||||
show = Some(Show::SshFingerprint);
|
||||
}
|
||||
Long("help") => {
|
||||
Long("help") | Short('h') => {
|
||||
return Err(Error::Help.into());
|
||||
}
|
||||
_ => return Err(anyhow::anyhow!(arg.unexpected())),
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ impl Args for Options {
|
|||
|
||||
timeout = time::Duration::from_secs(secs);
|
||||
}
|
||||
Long("help") => {
|
||||
Long("help") | Short('h') => {
|
||||
return Err(Error::Help.into());
|
||||
}
|
||||
Value(val) if rid.is_none() => {
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ impl Args for Options {
|
|||
|
||||
while let Some(arg) = parser.next()? {
|
||||
match arg {
|
||||
Long("help") => {
|
||||
Long("help") | Short('h') => {
|
||||
return Err(Error::Help.into());
|
||||
}
|
||||
Value(ref val) if id.is_none() => {
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ impl Args for Options {
|
|||
(Long("fetch"), Some(Operation::TrackRepo { .. })) => fetch = true,
|
||||
(Long("no-fetch"), Some(Operation::TrackRepo { .. })) => fetch = false,
|
||||
(Long("verbose") | Short('v'), _) => verbose = true,
|
||||
(Long("help"), _) => {
|
||||
(Long("help") | Short('h'), _) => {
|
||||
return Err(Error::Help.into());
|
||||
}
|
||||
_ => {
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ impl Args for Options {
|
|||
|
||||
while let Some(arg) = parser.next()? {
|
||||
match arg {
|
||||
Long("help") => {
|
||||
Long("help") | Short('h') => {
|
||||
return Err(Error::Help.into());
|
||||
}
|
||||
Long("from") => {
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ impl Args for Options {
|
|||
|
||||
while let Some(arg) = parser.next()? {
|
||||
match arg {
|
||||
Long("help") => {
|
||||
Long("help") | Short('h') => {
|
||||
return Err(Error::Help.into());
|
||||
}
|
||||
Value(ref val) if id.is_none() => {
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ impl Args for Options {
|
|||
}
|
||||
}
|
||||
(Long("verbose") | Short('v'), _) => verbose = true,
|
||||
(Long("help"), _) => {
|
||||
(Long("help") | Short('h'), _) => {
|
||||
return Err(Error::Help.into());
|
||||
}
|
||||
_ => {
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ impl Args for Options {
|
|||
frontend = Some(parser.value()?.to_string_lossy().to_string())
|
||||
}
|
||||
Long("json") => json = true,
|
||||
Long("help") => {
|
||||
Long("help") | Short('h') => {
|
||||
return Err(Error::Help.into());
|
||||
}
|
||||
_ => {
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ fn parse_options() -> Result<httpd::Options, lexopt::Error> {
|
|||
|
||||
aliases.insert(alias, id);
|
||||
}
|
||||
Long("help") => {
|
||||
Long("help") | Short('h') => {
|
||||
println!("usage: radicle-httpd [--listen <addr>] [--alias <name> <rid>]..");
|
||||
process::exit(0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ impl Options {
|
|||
let addr = parser.value()?.parse()?;
|
||||
listen.push(addr);
|
||||
}
|
||||
Long("help") => {
|
||||
Long("help") | Short('h') => {
|
||||
println!("{HELP_MSG}");
|
||||
process::exit(0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ impl Options {
|
|||
println!("{NAME} {VERSION}+{GIT_HEAD}");
|
||||
process::exit(0);
|
||||
}
|
||||
Long("help") => {
|
||||
Long("help") | Short('h') => {
|
||||
println!("{HELP}");
|
||||
process::exit(0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue