vorpal icon indicating copy to clipboard operation
vorpal copied to clipboard

How to offer options that are applicable to all commands?

Open balupton opened this issue 5 years ago • 0 comments

I'd like to offer options that are applicable to all commands. For instance, at a minimum, I'd like to do be able to do:

const vorpal = require('vorpal')()

vorpal
	.option('-o, --out <outPath>')
	.option('-c, --config <configPath>')
	.option('-e, --env <environment>')
	.option('-d, --debug [logLevel]')
	.option('-g, --global')
	.option('-f, --force')
	.option('--no-color')
	.option('--silent')
	.option('--skeleton <skeleton>')
	.option('--offline')

vorpal.parse(process.argv)

// do something with the options

// add the commands

vorpal.show()

Then I'd like to add the commands on later.

The use case here, is the ability to setup my application using the global configuration, then once the application is ready for input, and once all the apps plugins has extended vorpal with their own commands, then do the commands.

The application in question is docpad.

/cc https://github.com/docpad/docpad/issues/1048

balupton avatar Sep 05 '18 09:09 balupton