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

feat: support --version #67

Merged
merged 4 commits into from
Sep 9, 2023
Merged

feat: support --version #67

merged 4 commits into from
Sep 9, 2023

Conversation

Barbapapazes
Copy link
Member

πŸ”— Linked issue

fix #66

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

This PR adds, as same as -h / --help option, -v / --version option to show the version, if defined, of the CLI.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@Barbapapazes Barbapapazes self-assigned this Sep 5, 2023
@Barbapapazes Barbapapazes added the enhancement New feature or request label Sep 5, 2023
@Barbapapazes Barbapapazes requested a review from pi0 September 5, 2023 22:08
@pi0 pi0 changed the title feat: support -v or --version feat: support --version Sep 9, 2023
@pi0
Copy link
Member

pi0 commented Sep 9, 2023

Thanks for this PR i often needed it as well!

I have made few refactors to keep it simple with only --version support when no other args are provided to reduce chances of conflict with user args (such as -v for --verbose). We can improve this later.

@pi0 pi0 merged commit 4bf355e into main Sep 9, 2023
2 checks passed
@pi0 pi0 deleted the feat/version branch September 9, 2023 12:00
@SrBrahma
Copy link

SrBrahma commented Dec 20, 2023

I think it should support -v out of the box. It's much more probable to have -v for version than for --verbose. If the user don't want -v, the user should be able to redefine the version command where this alias isn't defined or is something else.

@SrBrahma
Copy link

SrBrahma commented Dec 21, 2023

Even better, if a command with alias h or v is defined, it overwrites the alias for help and version. I think it would be the best of all worlds.

I can happily make a PR for that. I like this lib, and it's very similar to a solution I did for myself some time ago.

@pi0
Copy link
Member

pi0 commented Dec 21, 2023

@SrBrahma can you please open an issue to keep track of this? Auto disable sounds nice idea (BTW, it is not that easy, we need to also scan all sub-commands if they support -v flag for custom behavior or not but seems worth to track)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing -v or --version flag
3 participants