From 91c587d95880e5fe8e3ee2740b54fbed3ae2cc2a Mon Sep 17 00:00:00 2001 From: Vikas Potluri Date: Mon, 11 Nov 2024 18:48:02 -0800 Subject: [PATCH] wip: disallow running `ghost config` without any arguments --- lib/commands/config.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/commands/config.js b/lib/commands/config.js index 62bc66f9d..06fd99ae8 100644 --- a/lib/commands/config.js +++ b/lib/commands/config.js @@ -1,4 +1,5 @@ 'use strict'; +const Yargs = require('yargs'); const Command = require('../command'); const options = require('../tasks/configure/options'); @@ -33,7 +34,9 @@ class ConfigCommand extends Command { } return; - } else if (key) { + } + + if (key) { // setter this.instance.config.set(key, value).save(); this.ui.log(`Successfully set '${key}' to '${value}'`, 'green'); @@ -53,6 +56,13 @@ class ConfigCommand extends Command { return; } + // CASE: No arguments provided + if (argv._.length === 1) { + Yargs.showHelp('log'); + this.ui.log('\nError: nothing to do'); + return; + } + const configure = require('../tasks/configure'); await configure(this.ui, this.instance.config, argv, this.system.environment, false); }