Skip to content

Commit

Permalink
add --version flag to output upkr version
Browse files Browse the repository at this point in the history
  • Loading branch information
exoticorn committed Oct 16, 2022
1 parent 887722a commit d7bdc8c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion release/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION=0.2.0
VERSION := $(shell cargo run --release -- --version)

all: clean upkr-linux-$(VERSION).tgz upkr-windows-$(VERSION).zip

Expand Down
6 changes: 6 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ fn main() -> Result<()> {
Short('l') | Long("level") => level = parser.value()?.parse()?,
Short(n) if n.is_ascii_digit() => level = n as u8 - b'0',
Short('h') | Long("help") => print_help(0),
Long("version") => {
println!("{}", env!("CARGO_PKG_VERSION"));
process::exit(0);
}
Long("max-unpacked-size") => max_unpacked_size = parser.value()?.parse()?,
Value(val) if infile.is_none() => infile = Some(val.try_into()?),
Value(val) if outfile.is_none() => outfile = Some(val.try_into()?),
Expand Down Expand Up @@ -155,6 +159,8 @@ fn print_help(exit_code: i32) -> ! {
eprintln!(" -u, --unpack unpack infile");
eprintln!(" --margin calculate margin for overlapped unpacking of a packed file");
eprintln!();
eprintln!("Version: {}", env!("CARGO_PKG_VERSION"));
eprintln!();
eprintln!("Config presets for specific unpackers:");
eprintln!(" --z80 --big-endian-bitstream --invert-bit-encoding --simplified-prob-update -9");
eprintln!(
Expand Down

0 comments on commit d7bdc8c

Please sign in to comment.