Skip to content

Commit

Permalink
feat(cli): add message when cli command is not found (#2430)
Browse files Browse the repository at this point in the history
* feat(cli): add message when cli command is not found

* chore: changeset
  • Loading branch information
tmm authored May 25, 2023
1 parent 0a6f537 commit 71d9202
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/gold-mirrors-smell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@wagmi/cli': patch
---

Added message when command is not found.
5 changes: 4 additions & 1 deletion packages/cli/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ void (async () => {
try {
// Parse CLI args without running command
cli.parse(process.argv, { run: false })
if (!cli.matchedCommand && cli.args.length === 0) cli.outputHelp()
if (!cli.matchedCommand) {
if (cli.args.length === 0) cli.outputHelp()
else throw new Error(`Unknown command: ${cli.args.join(' ')}`)
}
await cli.runMatchedCommand()
} catch (error) {
logger.error(`\n${(error as Error).message}`)
Expand Down

1 comment on commit 71d9202

@vercel
Copy link

@vercel vercel bot commented on 71d9202 May 25, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.