Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include git tag in --version output. #23

Merged
merged 1 commit into from
Nov 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/pre_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ jobs:

- name: Checkout code
uses: actions/checkout@v4
with:
fetch-tags: true

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-tags: true

- name: Publish
env:
Expand Down
48 changes: 48 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ license.workspace = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
clap = { version = "4.0.32", features = ["derive"] }
clap = { version = "4.0.32", features = ["derive", "cargo"] }
clap_mangen = "0.2.20"
clap_complete = "4.5.0"
human-panic = "2.0.2"
Expand All @@ -36,3 +36,5 @@ env_logger = "0.11.5"
anyhow = "1.0.75"
log = "0.4.20"
jbk.workspace = true
const_format = "0.2.33"
git-version = "0.3.9"
8 changes: 7 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@ use log::error;
use std::path::PathBuf;
use std::process::ExitCode;

const VERSION: &str = const_format::formatcp!(
"{} (git:{})",
clap::crate_version!(),
git_version::git_version!(args = ["--dirty=*", "--tags", "--always"])
);

#[derive(Parser)]
#[command(name = "waj", author, version, about, long_about=None)]
#[command(name = "waj", author, version, long_version=VERSION, about, long_about=None)]
struct Cli {
/// Set verbose level. Can be specify several times to augment verbose level.
#[arg(short, long, action=clap::ArgAction::Count, global=true)]
Expand Down