diff options
| author | Teddy Wing | 2020-08-02 09:48:07 +0200 | 
|---|---|---|
| committer | Teddy Wing | 2020-08-02 09:57:26 +0200 | 
| commit | c6ac35a6af7b9c00ba9341ecfff496da86bfab76 (patch) | |
| tree | 27ca1123b4016d0b95f5e6fcf3f1e8eb6e327fa4 /src/bin | |
| parent | b5f9bcca207ddb312adcf8e63ac7a430b6f0902f (diff) | |
| download | git-suggestion-c6ac35a6af7b9c00ba9341ecfff496da86bfab76.tar.bz2 | |
Add `-h` argument
Print usage on `-h` and `--help`.
Store the usage brief on `Config` in order to be able to print it from
multiple places.
Diffstat (limited to 'src/bin')
| -rw-r--r-- | src/bin/git-sugpatch.rs | 10 | 
1 files changed, 5 insertions, 5 deletions
diff --git a/src/bin/git-sugpatch.rs b/src/bin/git-sugpatch.rs index c8fc0a8..10499e9 100644 --- a/src/bin/git-sugpatch.rs +++ b/src/bin/git-sugpatch.rs @@ -10,7 +10,10 @@ use github_suggestion_cli::config::Config;  fn main() {      let args: Vec<_> = env::args().collect(); -    let config = match Config::get(&args) { +    let config = match Config::get( +        &args, +        "usage: git sugpatch [options] <suggestion>...", +    ) {          Ok(c) => c,          Err(e) => {              gseprintln!(e); @@ -20,10 +23,7 @@ fn main() {      };      if config.suggestions.is_empty() { -        print!( -            "{}", -            config.usage("usage: git sugpatch [options] <suggestion>..."), -        ); +        config.print_usage();          process::exit(exitcode::USAGE);      }  | 
