From 0f71cf6906dac7a95d51146afd3d4e9190b7828b Mon Sep 17 00:00:00 2001 From: Artturin Date: Tue, 19 Apr 2022 02:47:52 +0300 Subject: [PATCH] add --version --- Cargo.lock | 9 ++++++++- Cargo.toml | 4 ++-- src/main.rs | 3 ++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 29885d9..02e3c4f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -35,6 +35,7 @@ dependencies = [ "bitflags", "clap_lex", "indexmap", + "lazy_static", "strsim", "termcolor", "textwrap", @@ -51,7 +52,7 @@ dependencies = [ [[package]] name = "comma" -version = "1.2.1" +version = "1.2.3" dependencies = [ "clap", ] @@ -81,6 +82,12 @@ dependencies = [ "hashbrown", ] +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + [[package]] name = "libc" version = "0.2.123" diff --git a/Cargo.toml b/Cargo.toml index 573b85c..1e62e9d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "comma" description = "runs programs without installing them" -version = "1.2.1" +version = "1.2.3" edition = "2021" authors = ["Artturin "] license = "MIT" @@ -9,4 +9,4 @@ license = "MIT" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -clap = { version = "3.1.9", features = ["env"]} +clap = { version = "3.1.9", features = ["env", "cargo"]} diff --git a/src/main.rs b/src/main.rs index b234904..a8b67f9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,7 +5,7 @@ use std::{ process::{exit, Command, Stdio}, }; -use clap::{arg, Arg}; +use clap::{arg, Arg, crate_version}; fn pick(picker: &str, derivations: Vec<&str>) -> String { let mut picker_process = Command::new(&picker) @@ -54,6 +54,7 @@ fn run_command(use_channel: bool, choice: &str, command: &str, trail: Vec<&str>) fn main() { let matches = clap::Command::new("comma") .about("runs programs without installing them") + .version(crate_version!()) .arg( Arg::new("install") .short('i')