Skip to main content

Use uppercase text for variables in the help text

ID
20969df
date
2021-11-28 19:28:01+00:00
author
Alex Chan <alex@alexwlchan.net>
parent
523ba58
message
Use uppercase text for variables in the help text
changed files
1 file, 4 additions, 4 deletions

Changed files

src/main.rs (7768) → src/main.rs (7768)

diff --git a/src/main.rs b/src/main.rs
index 771cc6a..4430cba 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -17,13 +17,13 @@ fn main() {
             .author("Alex Chan <alex@alexwlchan.net>")
             .about("Find the dominant colours in an image")
             .arg(
-                Arg::with_name("path")
+                Arg::with_name("PATH")
                     .help("path to the image to inspect")
                     .required(true)
                     .index(1)
             )
             .arg(
-                Arg::with_name("max-colours")
+                Arg::with_name("MAX-COLOURS")
                     .long("max-colours")
                     .help("how many colours to find")
                     .default_value("5")
@@ -38,11 +38,11 @@ fn main() {
             .get_matches();
 
     // This .unwrap() is safe because "path" is a required param
-    let path = matches.value_of("path").unwrap();
+    let path = matches.value_of("PATH").unwrap();
 
     // Get the max colours as a number.
     // See https://github.com/clap-rs/clap/blob/v2.33.1/examples/12_typed_values.rs
-    let max_colours = value_t!(matches, "max-colours", usize).unwrap_or_else(|e| e.exit());
+    let max_colours = value_t!(matches, "MAX-COLOURS", usize).unwrap_or_else(|e| e.exit());
 
     let img = match image::open(&path) {
         Ok(im) => im,