diff --git a/cli/src/main.rs b/cli/src/main.rs index 9c43dc02b..062ea6d7f 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -64,6 +64,10 @@ struct Args { #[argh(option)] stdin_file_path: Option, + /// show version + #[argh(switch)] + version: bool, + /// the input and output files. /// /// First positional argument is the input file. If not specified, the @@ -209,6 +213,10 @@ fn run() -> Result<(), Box> { // Parse commandline arguments let args: Args = argh::from_env(); + if args.version { + println!("{}", env!("CARGO_PKG_VERSION")); + return Ok(()); + } let (input_path, input) = if let Some(path) = args.files.first() { let path = Path::new(path); (path, fs::read(path)?)