Skip to content

Commit

Permalink
Tweak version output in help
Browse files Browse the repository at this point in the history
  • Loading branch information
rcook committed Apr 15, 2023
1 parent 6adf6f1 commit b435f2b
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 116 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ jobs:
- name: Set variables
shell: bash
run: |
echo "ISOPY_BUILD_VERSION=${{ github.ref_name }}-$(git rev-parse HEAD)" >> $GITHUB_ENV
echo "archive_file_name=${{ env.project }}-${{ github.ref_name }}-${{ matrix.target }}${{ matrix.archive_ext }}" >> $GITHUB_ENV
echo "ISOPY_VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
- name: Install Cross
shell: bash
Expand Down
136 changes: 30 additions & 106 deletions Cargo.lock

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

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@ async-trait = "0.1.68"
bytes = "1.4.0"
clap = { version = "4.1.13", features = ["derive"] }
colored = "2.0.0"
default-env = "0.1.1"
flate2 = "1.0.25"
futures-util = "0.3.28"
git-version = "0.3.5"
hex = "0.4.3"
home = "0.5.4"
include_dir = "0.7.3"
Expand Down
16 changes: 9 additions & 7 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,22 @@
//
use crate::object_model::{EnvironmentName, Tag, Version};
use clap::{Parser, Subcommand};
use default_env::default_env;
use git_version::git_version;
use path_absolutize::Absolutize;
use std::path::PathBuf;
use std::result::Result;

const ISOPY_VERSION: &str = default_env!("ISOPY_VERSION", git_version!());
const PACKAGE_NAME: &str = env!("CARGO_PKG_NAME");
const PACKAGE_DESCRIPTION: &str = env!("CARGO_PKG_DESCRIPTION");
const PACKAGE_VERSION: &str = env!("CARGO_PKG_VERSION");
const PACKAGE_HOME_PAGE: &str = env!("CARGO_PKG_HOMEPAGE");
const PACKAGE_BUILD_VERSION: Option<&str> = option_env!("ISOPY_BUILD_VERSION");

#[derive(Parser, Debug)]
#[command(
name = env!("CARGO_PKG_NAME"),
about = format!("{} {}", env!("CARGO_PKG_DESCRIPTION"), ISOPY_VERSION),
after_help = format!("{}\nhttps://github.com/rcook/isopy", env!["CARGO_PKG_HOMEPAGE"]),
version = ISOPY_VERSION
name = PACKAGE_NAME,
version = PACKAGE_VERSION,
about = format!("{} {}", PACKAGE_DESCRIPTION, PACKAGE_VERSION),
after_help = format!("{}\nhttps://github.com/rcook/isopy{}", PACKAGE_HOME_PAGE, PACKAGE_BUILD_VERSION.map(|x| format!("\n\n{}", x)).unwrap_or(String::from("")))
)]
pub struct Args {
#[arg(global = true, help = "Path to isopy cache directory", short = 'd', long = "dir", value_parser = parse_absolute_path)]
Expand Down

0 comments on commit b435f2b

Please sign in to comment.