Fix cypress cache subcommands (#6348)

This commit is contained in:
Zach Bloomquist
2020-02-06 12:58:06 -05:00
committed by GitHub
parent c9bccf27f8
commit 09cdcdf0cb
2 changed files with 9 additions and 5 deletions

View File

@@ -131,6 +131,8 @@ exports['cli unknown option shows help for cache command - unknown sub-command f
stdout:
-------
error: unknown command: cache foo
Usage: cypress cache [command]
Manages the Cypress binary cache

View File

@@ -283,17 +283,19 @@ module.exports = {
.option('list', text('cacheList'))
.option('path', text('cachePath'))
.option('clear', text('cacheClear'))
.action(function (opts) {
if (!_.isString(opts)) {
.action(function (opts, args) {
if (!args || !args.length) {
this.outputHelp()
util.exit(1)
}
if (opts.command || !_.includes(['list', 'path', 'clear'], opts)) {
unknownOption.call(this, `cache ${opts}`, 'command')
const [command] = args
if (!_.includes(['list', 'path', 'clear'], command)) {
unknownOption.call(this, `cache ${command}`, 'command')
}
cache[opts]()
cache[command]()
})
debug('cli starts with arguments %j', args)