From 790e45419c4ecc6c7bcce06bd6369d78b506bc8f Mon Sep 17 00:00:00 2001 From: Jeff Smale <6363749+jeffsmale90@users.noreply.github.com> Date: Fri, 21 Apr 2023 14:37:11 +1200 Subject: [PATCH 1/3] Output error message and instances command help when no subcommand is provided --- src/packages/cli/src/args.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/packages/cli/src/args.ts b/src/packages/cli/src/args.ts index f76f0ccc03..71b180b51d 100644 --- a/src/packages/cli/src/args.ts +++ b/src/packages/cli/src/args.ts @@ -281,9 +281,17 @@ export default function ( } ) .version(false); + }, + function () { + // this handler executes when `ganache instances` is called without a subcommand + const command = chalk`{hex("${TruffleColors.porsche}") ganache instances}`; + console.log(`${command} requires a subcommand:`); + console.log(); + yargs.showHelp(); + yargs.exit(1, new Error("No subcommand provided")); } ) - .showHelpOnFail(false, "Specify -? or --help for available options") + .showHelpOnFail(false) .alias("help", "?") .wrap(wrapWidth) .version(version); From 31ccb1a1d3492bf43109b8bf1e22bcdd272818b7 Mon Sep 17 00:00:00 2001 From: jeffsmale90 <6363749+jeffsmale90@users.noreply.github.com> Date: Wed, 26 Apr 2023 10:11:23 +1200 Subject: [PATCH 2/3] Change colon to . Co-authored-by: David Murdoch <187813+davidmurdoch@users.noreply.github.com> --- src/packages/cli/src/args.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/packages/cli/src/args.ts b/src/packages/cli/src/args.ts index 71b180b51d..bcf686bd20 100644 --- a/src/packages/cli/src/args.ts +++ b/src/packages/cli/src/args.ts @@ -285,7 +285,7 @@ export default function ( function () { // this handler executes when `ganache instances` is called without a subcommand const command = chalk`{hex("${TruffleColors.porsche}") ganache instances}`; - console.log(`${command} requires a subcommand:`); + console.log(`${command} requires a subcommand.`); console.log(); yargs.showHelp(); yargs.exit(1, new Error("No subcommand provided")); From 7ab20aea296f10bb9fc79171c18951efce774539 Mon Sep 17 00:00:00 2001 From: Jeff Smale <6363749+jeffsmale90@users.noreply.github.com> Date: Wed, 26 Apr 2023 10:59:39 +1200 Subject: [PATCH 3/3] Change wording of 'missing subcommand' message --- src/packages/cli/src/args.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/packages/cli/src/args.ts b/src/packages/cli/src/args.ts index bcf686bd20..fcbe33acbd 100644 --- a/src/packages/cli/src/args.ts +++ b/src/packages/cli/src/args.ts @@ -285,7 +285,7 @@ export default function ( function () { // this handler executes when `ganache instances` is called without a subcommand const command = chalk`{hex("${TruffleColors.porsche}") ganache instances}`; - console.log(`${command} requires a subcommand.`); + console.log(`Missing subcommand for ${command}.`); console.log(); yargs.showHelp(); yargs.exit(1, new Error("No subcommand provided"));