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: add usage line for version #85

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

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
src/usage.ts Outdated Show resolved Hide resolved
@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

@@ -50,7 +51,15 @@ export async function runCommand<T extends ArgsDef = ArgsDef>(
);
}
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.

None yet

2 participants