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.")]
help: bool,
#[options(help = "Print version info and exit.", short = "V")]
version: bool,
#[options(
help = "Run the given age plugin state machine. Internal use only.",
meta = "STATE-MACHINE",
@@ -259,6 +262,9 @@ fn main() -> Result<(), Error> {
plugin::IdentityPlugin::default,
)?;
Ok(())
} else if opts.version {
println!("age-plugin-yubikey {}", env!("CARGO_PKG_VERSION"));
Ok(())
} else if opts.generate {
generate(opts)
} else if opts.identity {