Skip to content

feat: add usage line for version#85

Open
Barbapapazes wants to merge 5 commits intomainfrom
feat/print-version-on-error
Open

feat: add usage line for version#85
Barbapapazes wants to merge 5 commits intomainfrom
feat/print-version-on-error

Conversation

@Barbapapazes
Copy link
Member

🔗 Linked issue

❓ 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

Add usage line to tell users how to get the version of the CLI.

📝 Checklist

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

@Barbapapazes Barbapapazes requested a review from pi0 October 11, 2023 13:40
@Barbapapazes Barbapapazes self-assigned this Oct 11, 2023
@Barbapapazes Barbapapazes marked this pull request as ready for review October 11, 2023 13:40
@Barbapapazes
Copy link
Member Author

I've updated my PR.

  • When user run a sub command with --version, print version and does not run sub command (same behavior as main command)
  • Empty line to add space between types of data is controlled by the next block.
  • Only show --version when there is one

const subCommand = await resolveValue(subCommands[subCommandName]);
if (subCommand) {
// Same behavior as for runMain (see src/main.ts)
if (opts.rawArgs.includes("--version")) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe, I should move it to another PR.

and should I create a function to avoid duplication with https://github.com/unjs/citty/blob/1cb60fe5b5aa7be64206e8d865b847adafae6549/src/main.ts#L22C7-L22C7 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants