Skip to content

Commit

Permalink
feat(cli): add --version argument
Browse files Browse the repository at this point in the history
  • Loading branch information
vyfor committed Dec 23, 2024
1 parent f43c94d commit 1799242
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/cli/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ impl Args {
let mut i = 1;
while i < args.len() {
match args[i].as_str() {
"--version" | "-v" => {
print!("{}", env!("CARGO_PKG_VERSION"));
std::process::exit(0);
}
"--pipe-name" | "-p" => {
if i + 1 < args.len() {
pipe_name = Some(args[i + 1].clone());
Expand Down Expand Up @@ -74,6 +78,8 @@ impl Args {
}
}

println!("v{}", env!("CARGO_PKG_VERSION"));

Ok(Args {
pipe_name: pipe_name
.unwrap_or_else(|| DEFAULT_PIPE_NAME.to_string()),
Expand Down

0 comments on commit 1799242

Please sign in to comment.