Skip to content

Commit

Permalink
#25: Add in basic --debug flag handling
Browse files Browse the repository at this point in the history
  • Loading branch information
pirog committed Sep 27, 2021
1 parent 69f27ab commit ee9b461
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions cli/hooks/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,30 @@ class DynamicPlugin extends Config.Plugin {

module.exports = async({id, argv, config}) => {
let debug = createDebugger(config.dirname, 'hooks', 'init');

// @TODO: set this based on some options (--debug?). if boolean/null should set * if string should set as if DEBUG
// envvar was set.
// @NOTE: this shows all debug right now for dev purposes. see @TODO above.
// require('debug').enable('*'); // eslint-disable-line node/no-extraneous-require
// Check for --debug and internally set DEBUG=* if its set
// @TODO: we should make debug a string flag so it can work like setting DEBUG=something
// @TODO: should we handle --debug on our own or use something lightweight like minimist?
if ([id, ...argv].find(element => element === '--debug') === '--debug') {
require('debug').enable('*'); // eslint-disable-line node/no-extraneous-require
}
// Below is mostly just to DEBUG confirm we get this far
debug('cli init start with id=%s, argv=%O', id, argv);

// @TODOS:
/*
* ~~1. get debug flag~~
* 2. plugin helper commands that to do not require lodash (find plugins)
* 3. extended plugin class with extra methods?
* * eg removeCommand, replaceCommand
* 4. extended plugin class with ability to dynamically add commands vs from manifest file
* 5. create metadata to handle the below
* 6. revisit config loading to handle metadata above (ministrapper -> configurator)
* 7. stub out all our needed commands, methods, installers, etc
* 8. revisit get help, we need a help class that can delegate help and print other things eg list of available installers
* 9. stub out hyperdrive library?
* 10. move configurator into its own thing, move oclif helpers in their own thing?
*/

// handle argv aliases
if ((id === 'install' || id === 'uninstall') && argv[0] === 'engine') {
argv[0] = 'docker-desktop';
Expand Down

0 comments on commit ee9b461

Please # to comment.