add --version

This commit is contained in:
Artturin 2022-04-19 02:47:52 +03:00
parent 98043ec1e1
commit 0f71cf6906
3 changed files with 12 additions and 4 deletions

9
Cargo.lock generated
View file

@ -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"

View file

@ -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 <Artturin@artturin.com>"]
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"]}

View file

@ -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')