Add version flag

This commit is contained in:
Jack Grigg
2021-04-15 21:52:43 +12:00
parent dd8589811b
commit 9fb8cd5f86
+6
View File
@@ -52,6 +52,9 @@ struct PluginOptions {
#[options(help = "Print this help message and exit.")] #[options(help = "Print this help message and exit.")]
help: bool, help: bool,
#[options(help = "Print version info and exit.", short = "V")]
version: bool,
#[options( #[options(
help = "Run the given age plugin state machine. Internal use only.", help = "Run the given age plugin state machine. Internal use only.",
meta = "STATE-MACHINE", meta = "STATE-MACHINE",
@@ -259,6 +262,9 @@ fn main() -> Result<(), Error> {
plugin::IdentityPlugin::default, plugin::IdentityPlugin::default,
)?; )?;
Ok(()) Ok(())
} else if opts.version {
println!("age-plugin-yubikey {}", env!("CARGO_PKG_VERSION"));
Ok(())
} else if opts.generate { } else if opts.generate {
generate(opts) generate(opts)
} else if opts.identity { } else if opts.identity {