fix(CLI): add check for drive flag with yes flag (#1753)

Add an options check for the `drive` flag to appear with the `yes` flag.
If the `yes` flag appears without the `drive` flag then a user error
will be thrown.

Change-Type: patch
Link: https://github.com/resin-io/etcher/pull/1753
Fixes: https://github.com/resin-io/etcher/issues/1454
This commit is contained in:
Josh Leeb-du Toit 2017-11-14 22:02:43 +11:00 committed by Andrew Scheller
parent 33db722f68
commit e815d97265

View File

@ -134,6 +134,18 @@ module.exports = yargs
return true
})
// Assert that if the `yes` flag is provided, the `drive` flag is also provided.
.check((argv) => {
if (argv.yes && !argv.drive) {
throw errors.createUserError({
title: 'Missing drive',
description: 'You need to explicitly pass a drive when disabling interactively'
})
}
return true
})
.options({
help: {
describe: 'show help',