Skip to content

Commit

Permalink
#25: Remove windows command entrypoint and move debug handling to top…
Browse files Browse the repository at this point in the history
… of bin/hyperdrive
  • Loading branch information
pirog committed Sep 24, 2021
1 parent 222f8ce commit ff99de0
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
10 changes: 10 additions & 0 deletions bin/hyperdrive
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
#!/usr/bin/env node

// 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?
// @TODO: or maybe add this as a util?
// @TODO: we should give preference to process.env.DEBUG if its set.
if (process.argv.slice(2).find(element => element === '--debug') === '--debug') {
require('debug').enable('*'); // eslint-disable-line node/no-extraneous-require
}

require('@oclif/command')
.run()
.then(require('@oclif/command/flush'))
Expand Down
3 changes: 0 additions & 3 deletions bin/hyperdrive.cmd

This file was deleted.

21 changes: 11 additions & 10 deletions cli/hooks/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,23 @@ const LandoOclifPlugin = require('./../../utils/plugin');

module.exports = async({id, argv, config}) => {
let debug = createDebugger(config.dirname, 'hooks', 'init');
// 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?
// @TODO: or maybe add this as a util?
// @TODO: this should go at the top of bin/hyperdrive so we get debug output before this point
// @TODO: we should give preference to process.env.DEBUG if its set.
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 can get this far
debug('cli init start with id=%s, argv=%O', id, argv);

// @TODO: eventually we will want to grab a cached config file that was the result of a previous bootstrap
// for speed purposes, we want to minimize the time it takes to show the list of commands or help and put all
// time instensive dep loading after the command has been run().
// @NOTE that the config file should likely be in a hashmap where landoAppRoot -> someconfigfile because a Landofile
// may contain plugins that hyperdrive needs to install for that lando app or it may contain some config overrides
// eg maybe a given lando app wants to set a default plugin install method or provides a new installer/command
// within itself
// @TODO: this also implies we have a way to delete the cache, it would be cool if we could target that deletion
// for specific things so that clearing the cache for app A does not blow away the cache for app B

// @TODOS:
/*
* ~~1. get debug flag~~
* 2. plugin helper commands that to do not require lodash (find plugins)
* ~~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
Expand Down

0 comments on commit ff99de0

Please sign in to comment.