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(oas:cli): output better error when no command is provided #3559

Merged
merged 4 commits into from
Mar 26, 2023

Conversation

patrick-medusajs
Copy link
Contributor

What

Improve error messages when incorrect arguments are passed to medusa-oas cli

Why

Improve DevX and allow developers to self-troubleshot issues.

How

  • Declare a base/root command that displays --help when invoked.
  • Display help by default when a parsing error occurs by enabling showHelpAfterError on all commands.

Tests

Test 1 - root

  • Run yarn medusa-oas
  • Expect output:
No command provided.
Usage: medusa-oas [command]

Commands:
  oas [options]     Compile full OAS from swagger-inline compliant JSDoc.
  client [options]  Generate API clients from OAS.

Test 2 - root with unknown option

  • Run yarn medusa-oas --foo
  • Expect same output as above

Test 3 - subcommand with error

  • Run yarn medusa-oas oas --foo
  • Expect error: unknown option '--foo' and the medusa-oas oas --help to be displayed

@patrick-medusajs patrick-medusajs self-assigned this Mar 23, 2023
@changeset-bot
Copy link

changeset-bot bot commented Mar 23, 2023

🦋 Changeset detected

Latest commit: 9e7a652

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@medusajs/medusa-oas-cli Patch
@medusajs/oas-github-ci Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Mar 23, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
medusa-docs ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Mar 24, 2023 at 3:29PM (UTC)

@olivermrbl olivermrbl merged commit 53c4a43 into develop Mar 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants