feat(oas:cli): output better error when no command is provided (#3559)

* feat(oas:cli): output better error when no command is provided

* chore(changeset): patch

---------

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
Patrick
2023-03-26 05:59:52 -04:00
committed by GitHub
parent bd199d7f44
commit 53c4a43ca2
4 changed files with 20 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
---
"@medusajs/medusa-oas-cli": patch
---
feat(oas:cli): output better error when no command is provided

View File

@@ -61,6 +61,7 @@ export function getCommand() {
command.addOption(opt)
}
command.action(async (options) => await execute(options))
command.showHelpAfterError(true)
return command
}

View File

@@ -61,6 +61,7 @@ export function getCommand() {
command.addOption(opt)
}
command.action(async (options) => await execute(options))
command.showHelpAfterError(true)
return command
}

View File

@@ -5,7 +5,7 @@ import { getCommand as oasGetCommand } from "./command-oas"
import { getCommand as clientGetCommand } from "./command-client"
const run = async () => {
const program = new Command()
const program = getBaseCommand()
/**
* Alias to command-oas.ts
@@ -23,6 +23,18 @@ const run = async () => {
await program.parseAsync()
}
export function getBaseCommand() {
const command = new Command()
command.name("medusa-oas")
command.action(async () => {
console.log("No command provided.")
command.outputHelp({ error: true })
})
command.showHelpAfterError(true)
command.helpOption(false)
return command
}
void (async () => {
await run()
})()