Repository: google/argh
Pull request #105 (2021-08-30 23:33:17)

Prepping for release


Patch:
diff --git a/argh/Cargo.toml b/argh/Cargo.toml
index 053798c..80f71d3 100644
--- a/argh/Cargo.toml
+++ b/argh/Cargo.toml
@@ -1,14 +1,14 @@
 [package]
 name = "argh"
-version = "0.1.5"
+version = "0.1.6"
 authors = ["Taylor Cramer <cramertj@google.com>", "Benjamin Brittain <bwb@google.com>", "Erick Tryzelaar <etryzelaar@google.com>"]
 edition = "2018"
 keywords = ["args", "arguments", "derive", "cli"]
-license-file = "LICENSE"
+license = "BSD-3-Clause"
 description = "Derive-based argument parser optimized for code size"
 repository = "https://github.com/google/argh"
 readme = "README.md"
 
 [dependencies]
-argh_shared = { version = "0.1.5", path = "../argh_shared" }
-argh_derive = { version = "0.1.5", path = "../argh_derive" }
+argh_shared = { version = "0.1.6", path = "../argh_shared" }
+argh_derive = { version = "0.1.6", path = "../argh_derive" }
diff --git a/argh_derive/Cargo.toml b/argh_derive/Cargo.toml
index dea0d38..39712d5 100644
--- a/argh_derive/Cargo.toml
+++ b/argh_derive/Cargo.toml
@@ -1,9 +1,9 @@
 [package]
 name = "argh_derive"
-version = "0.1.5"
+version = "0.1.6"
 authors = ["Taylor Cramer <cramertj@google.com>", "Benjamin Brittain <bwb@google.com>", "Erick Tryzelaar <etryzelaar@google.com>"]
 edition = "2018"
-license-file = "LICENSE"
+license = "BSD-3-Clause"
 description = "Derive-based argument parsing optimized for code size"
 repository = "https://github.com/google/argh"
 readme = "README.md"
diff --git a/argh_derive/src/help.rs b/argh_derive/src/help.rs
index 82bfc47..9a2c5b9 100644
--- a/argh_derive/src/help.rs
+++ b/argh_derive/src/help.rs
@@ -11,6 +11,7 @@ use {
     argh_shared::INDENT,
     proc_macro2::{Span, TokenStream},
     quote::quote,
+    syn::LitStr,
 };
 
 const SECTION_SEPARATOR: &str = "\n\n";
@@ -126,7 +127,9 @@ fn positional_usage(out: &mut String, field: &StructField<'_>) {
         out.push('[');
     }
     out.push('<');
-    out.push_str(&field.name.to_string());
+    let name =
+        field.attrs.arg_name.as_ref().map(LitStr::value).unwrap_or_else(|| field.name.to_string());
+    out.push_str(&name);
     if field.optionality == Optionality::Repeating {
         out.push_str("...");
     }
diff --git a/argh_shared/Cargo.toml b/argh_shared/Cargo.toml
index d579980..2c24892 100644
--- a/argh_shared/Cargo.toml
+++ b/argh_shared/Cargo.toml
@@ -1,9 +1,9 @@
 [package]
 name = "argh_shared"
-version = "0.1.5"
+version = "0.1.6"
 authors = ["Taylor Cramer <cramertj@google.com>", "Benjamin Brittain <bwb@google.com>", "Erick Tryzelaar <etryzelaar@google.com>"]
 edition = "2018"
-license-file = "LICENSE"
+license = "BSD-3-Clause"
 description = "Derive-based argument parsing optimized for code size"
 repository = "https://github.com/google/argh"
 readme = "README.md"


Test patch:
diff --git a/tests/lib.rs b/argh/tests/lib.rs
similarity index 98%
rename from tests/lib.rs
rename to argh/tests/lib.rs
index 9369bad..963540e 100644
--- a/tests/lib.rs
+++ b/argh/tests/lib.rs
@@ -872,6 +872,27 @@ Notes:
 Error codes:
   2 The blade is too dull.
   3 Out of fuel.
+"###,
+        );
+    }
+
+    #[allow(dead_code)]
+    #[derive(argh::FromArgs)]
+    /// Destroy the contents of <file>.
+    struct WithArgName {
+        #[argh(positional, arg_name = "name")]
+        username: String,
+    }
+
+    #[test]
+    fn with_arg_name() {
+        assert_help_string::<WithArgName>(
+            r###"Usage: test_arg_0 <name>
+
+Destroy the contents of <file>.
+
+Options:
+  --help            display usage information
 "###,
         );
     }