summaryrefslogtreecommitdiffstats
path: root/vendor/xflags/examples/hello-generated.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/xflags/examples/hello-generated.rs')
-rw-r--r--vendor/xflags/examples/hello-generated.rs13
1 files changed, 5 insertions, 8 deletions
diff --git a/vendor/xflags/examples/hello-generated.rs b/vendor/xflags/examples/hello-generated.rs
index b82884859..cb74acbd7 100644
--- a/vendor/xflags/examples/hello-generated.rs
+++ b/vendor/xflags/examples/hello-generated.rs
@@ -5,10 +5,10 @@ mod flags {
src "./examples/hello-generated.rs"
/// Prints a greeting.
- cmd hello
+ cmd hello {
/// Whom to greet.
required name: String
- {
+
/// Use non-ascii symbols in the output.
optional -e, --emoji
}
@@ -25,12 +25,12 @@ mod flags {
}
impl Hello {
- pub const HELP: &'static str = Self::HELP_;
-
+ #[allow(dead_code)]
pub fn from_env() -> xflags::Result<Self> {
Self::from_env_()
}
+ #[allow(dead_code)]
pub fn from_vec(args: Vec<std::ffi::OsString>) -> xflags::Result<Self> {
Self::from_vec_(args)
}
@@ -44,9 +44,6 @@ fn main() {
let bang = if flags.emoji { "❣️" } else { "!" };
println!("Hello {}{}", flags.name, bang);
}
- Err(err) => {
- eprintln!("{}\n\n{}", err, flags::Hello::HELP);
- std::process::exit(1)
- }
+ Err(err) => err.exit(),
}
}