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

Add long-form version output #1930

Merged
merged 1 commit into from
Feb 23, 2024
Merged

Add long-form version output #1930

merged 1 commit into from
Feb 23, 2024

Conversation

zanieb
Copy link
Member

@zanieb zanieb commented Feb 23, 2024

Similar to astral-sh/ruff#8034

Adds more version information so it's clear what revision the user is on

❯ cargo run -q -- --version
uv 0.1.10 (daa8565a7 2024-02-23)
❯ cargo run -q -- -V
uv 0.1.10
❯ cargo run -q -- version
uv 0.1.10 (daa8565a7 2024-02-23)
❯ cargo run -q -- version --output-format json
{
  "version": "0.1.10",
  "commit_info": {
    "short_commit_hash": "daa8565a7",
    "commit_hash": "daa8565a75249305821fdc34ace085060c082ba3",
    "commit_date": "2024-02-23",
    "last_tag": null,
    "commits_since_last_tag": 0
  }
}

@zanieb zanieb added the cli Related to the command line interface label Feb 23, 2024

const DEFAULT_VENV_NAME: &str = ".venv";

#[derive(Parser)]
#[command(author, version, about)]
#[command(author, version, long_version = crate::version::version(), about)]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could port this over to Ruff if we want

Comment on lines +126 to +130
/// Display uv's version
Version {
#[arg(long, value_enum, default_value = "text")]
output_format: VersionFormat,
},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idk about the json output format, included because it's that way in Ruff.

@zanieb zanieb merged commit af39bbd into main Feb 23, 2024
7 checks passed
@zanieb zanieb deleted the zb/version branch February 23, 2024 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Related to the command line interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants