Skip to content

Add long-form version output#1930

Merged
zanieb merged 1 commit intomainfrom
zb/version
Feb 23, 2024
Merged

Add long-form version output#1930
zanieb merged 1 commit intomainfrom
zb/version

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

#[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
@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.

2 participants