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 git commit hash to --version for ya CLI tool #994

Closed
1 task
sxyazi opened this issue May 3, 2024 · 5 comments
Closed
1 task

Add git commit hash to --version for ya CLI tool #994

sxyazi opened this issue May 3, 2024 · 5 comments
Assignees
Labels
feature New feature request good first issue Good for newcomers

Comments

@sxyazi
Copy link
Owner

sxyazi commented May 3, 2024

Please describe the problem you're trying to solve

Currently, running ya --version will output:

ya 0.2.5

which looks plain and lacks sufficient information to confirm the specific version the user is using.

Would you be willing to contribute this feature?

  • Yes, I'll give it a shot

Describe the solution you'd like

It would be great if it could include the git commit hash at build time, similar to yazi --version:

Yazi 0.2.5 (36b3ffa 2024-05-02)

This is the code used to get the commit hash for yazi --version:

fn action_version() -> String {
format!(
"{} ({} {})",
env!("CARGO_PKG_VERSION"),
env!("VERGEN_GIT_SHA"),
env!("VERGEN_BUILD_DATE")
)
}

Additional context

No response

@sxyazi sxyazi added feature New feature request good first issue Good for newcomers labels May 3, 2024
@fzdwx
Copy link
Contributor

fzdwx commented May 4, 2024

just call Boot::action_version() ?

@mikavilpas
Copy link
Contributor

@fzdwx I think this suggestion could be what you want

  1. Add support to ya for a new argument (--version) here
    #[derive(Parser)]
    #[command(name = "ya", version, about, long_about = None)]
    #[command(propagate_version = true)]
    pub(super) struct Args {
    #[command(subcommand)]
    pub(super) command: Command,
    }
    #[derive(Subcommand)]
    pub(super) enum Command {
    /// Publish a message to remote instance(s).
    Pub(CommandPub),
    /// Publish a static message to all remote instances.
    PubStatic(CommandPubStatic),
    }
  2. Add the implementation for that command by copying from the action_version above
  3. Follow the errors and implement build time version generation etc from yazi-fm

@fzdwx
Copy link
Contributor

fzdwx commented May 4, 2024

@mikavilpas Hello, thank you tip for me. Please check it #1006.

@sxyazi
Copy link
Owner Author

sxyazi commented May 4, 2024

Done in #1006

@sxyazi sxyazi closed this as completed May 4, 2024
Copy link

github-actions bot commented Jun 4, 2024

I'm going to lock this issue because it has been closed for 30 days. ⏳
This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature New feature request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants