-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
173 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const {Command, flags} = require('@oclif/command'); | ||
|
||
class GoodbyeCommand extends Command { | ||
async run() { | ||
const {flags} = this.parse(GoodbyeCommand); | ||
const name = flags.name || 'world'; | ||
console.log(flags); | ||
this.log(`goodbye ${name} from ./src/commands/hello.js`); | ||
} | ||
} | ||
GoodbyeCommand.description = `awsgwag the command here | ||
... | ||
Extra documentation goes here | ||
`; | ||
|
||
GoodbyeCommand.flags = { | ||
name: flags.string({char: 'q', description: 'name to print'}), | ||
}; | ||
|
||
GoodbyeCommand.hidden = true; | ||
|
||
module.exports = GoodbyeCommand; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = async options => { | ||
console.log(`example cnt hook running before ${options.id}`) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
const { Command } = require('@oclif/config'); | ||
const {flags} = require('@oclif/command'); | ||
const Config = require('@oclif/config'); | ||
|
||
class DynamicPlugin extends Config.Plugin { | ||
get hooks() { return {} } | ||
get topics() { | ||
return [] | ||
} | ||
get commandIDs() { | ||
return ['mydynamiccommand'] | ||
} | ||
|
||
get commands() { | ||
const cmd = require('./../more/bye'); | ||
cmd.id = 'bye'; | ||
cmd.load = () => cmd; | ||
return [cmd]; | ||
} | ||
} | ||
|
||
/* | ||
* New plugin types: | ||
* HyperdrivePlugin extends Config.Plugin | ||
* 1. accepts a list of commands and an optional selector function for a "parent" | ||
* | ||
* | ||
*/ | ||
|
||
module.exports = async (options) => { | ||
// commands = [require('./../more/bye')]; | ||
// config.plugins.push(new DynamicPlugin(config)) | ||
// console.log(config.plugins); | ||
// config.plugins[0].commands[0].flags.stuff = flags.string({char: 'z', description: 'name to print'}); | ||
console.log(options); // {id, argv, conf} | ||
|
||
// Set DEBUG=* when -vvv is set? | ||
|
||
// Load in bootstrap config from configDir | ||
/* | ||
bootstrap: | ||
bootstrapper: ./lib/bootstrap.js | ||
envPrefix: | ||
- HYPERDRIVE_ | ||
configSources: | ||
- config.yml | ||
mode: 'cli', | ||
packaged: _.has(process, 'pkg'), | ||
channel: stable? | ||
leia: _.has(process, 'env.LEIA_PARSER_RUNNING') | ||
pluginDirs: _.compact(pluginDirs.concat(process.landoAppPluginDirs)) | ||
plugins: , | ||
product: 'lando', | ||
userAgent: `Lando/${version}`, | ||
// | ||
channel: 'stable', | ||
landoFile: '.lando.yml', | ||
logLevelConsole: (this.argv().verbose) ? this.argv().verbose + 1 : this.logLevel, | ||
logDir: path.join(this.userConfRoot, 'logs'), | ||
mode: 'cli', | ||
packaged: _.has(process, 'pkg'), | ||
pluginDirs: _.compact(pluginDirs.concat(process.landoAppPluginDirs)), | ||
preLandoFiles: ['.lando.base.yml', '.lando.dist.yml', '.lando.upstream.yml'], | ||
postLandoFiles: ['.lando.local.yml'], | ||
userConfRoot: this.userConfRoot, | ||
version, | ||
*/ | ||
|
||
// run bootstrap | ||
// 1. merge in more config | ||
// 2. go through plugins and build manifest of components/config/whatever | ||
// 3. traverse plugins to find commands | ||
// 4. what do commandIDs do? | ||
// 5. install defaults eg desktop -> lando-desktop | ||
/* | ||
hyperdrive: | ||
// list of installers | ||
installers: | ||
// Just OCLIF command objects, this is just a list of metadata | ||
commands: | ||
- {id: 'install', variant: 'lando-docker-engine', path: } | ||
plugins: | ||
- pathtofunction -> gets config and returns plugin | ||
// Final mods to commands, useful to add more options/args etc | ||
mods: (?) | ||
- {id: 'install', path: } | ||
*/ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = async options => { | ||
console.log(`example postrun hook running before ${options.id}`) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const _ = require('lodash'); | ||
const {flags} = require('@oclif/command'); | ||
|
||
module.exports = async options => { | ||
// options.Command = require('./../commands/hello2'); | ||
// console.log(options); | ||
// options.Command.flags.name2 = flags.string({char: 'z', description: 'name to print'}), | ||
|
||
|
||
console.log(`example prerun hook running before ${options.id}`) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const {Command, flags} = require('@oclif/command'); | ||
|
||
class GoodbyeCommand extends Command { | ||
async run() { | ||
const {flags} = this.parse(GoodbyeCommand); | ||
const name = flags.name || 'world'; | ||
console.log(flags); | ||
this.log(`FU ${name} from ./src/commands/hello.js`); | ||
} | ||
} | ||
GoodbyeCommand.name = 'bye'; | ||
GoodbyeCommand.description = `awsgwag the command here | ||
... | ||
Extra documentation goes here | ||
`; | ||
|
||
GoodbyeCommand.flags = { | ||
name: flags.string({char: 'q', description: 'name to print'}), | ||
}; | ||
|
||
GoodbyeCommand.hidden = false; | ||
|
||
module.exports = GoodbyeCommand; |