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:
5
.changeset/tender-turkeys-exist.md
Normal file
5
.changeset/tender-turkeys-exist.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@medusajs/medusa-oas-cli": patch
|
||||
---
|
||||
|
||||
feat(oas:cli): output better error when no command is provided
|
||||
@@ -61,6 +61,7 @@ export function getCommand() {
|
||||
command.addOption(opt)
|
||||
}
|
||||
command.action(async (options) => await execute(options))
|
||||
command.showHelpAfterError(true)
|
||||
return command
|
||||
}
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ export function getCommand() {
|
||||
command.addOption(opt)
|
||||
}
|
||||
command.action(async (options) => await execute(options))
|
||||
command.showHelpAfterError(true)
|
||||
return command
|
||||
}
|
||||
|
||||
|
||||
@@ -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()
|
||||
})()
|
||||
|
||||
Reference in New Issue
Block a user