Skip to content

Commit 87efca8

Browse files
committed
#25: Stub out command files for core apis
1 parent 8e9765b commit 87efca8

File tree

14 files changed

+609
-104
lines changed

14 files changed

+609
-104
lines changed

.eslintrc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
{
2-
"extends": "oclif",
2+
"extends": ["oclif"],
3+
"parser": "@babel/eslint-parser",
4+
"parserOptions": {
5+
"requireConfigFile": false
6+
},
37
"rules": {
48
"no-console": ["warn"],
59
"semi": ["error", "always"],

cli/commands/add.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
const {Command} = require('@oclif/command');
2+
3+
class InstallCommand extends Command {
4+
static description = 'install things';
5+
6+
static usage = 'usage';
7+
8+
static aliases = ['install'];
9+
10+
static examples = [];
11+
12+
async run() {
13+
const {flags} = this.parse(InstallCommand);
14+
const name = flags.name || 'world';
15+
this.log(`goodbye ${name} from ./src/commands/hello.js`);
16+
}
17+
}
18+
19+
module.exports = InstallCommand;

cli/commands/bye.js

Lines changed: 0 additions & 21 deletions
This file was deleted.

cli/commands/config.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
const {Command, flags} = require('@oclif/command');
2+
3+
class UninstallCommand extends Command {
4+
// static _base = 'thing';
5+
// static id = 'thing';
6+
// static title = 'title';
7+
8+
static description = `Describe the command here
9+
10+
Extra documentation goes here
11+
`;
12+
// static hidden - false;
13+
14+
static usage = 'stuff';
15+
16+
static help = 'stuff';
17+
18+
// static aliases = ['uninstall'];
19+
20+
// static strict = false;
21+
// static parse = true;
22+
static flags = {
23+
name: flags.string({char: 'n', description: 'name to print'}),
24+
}
25+
26+
// static args
27+
// static plugin
28+
// static examples
29+
// static parserOptions
30+
// static
31+
32+
static flags = {
33+
name: flags.string({char: 'n', description: 'name to print'}),
34+
}
35+
36+
async run() {
37+
const {flags} = this.parse(UninstallCommand);
38+
const name = flags.name || 'world';
39+
this.log(`hello ${name} from ./src/commands/hello.js`);
40+
}
41+
}
42+
43+
module.exports = UninstallCommand;

cli/commands/hello.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

cli/commands/info.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
const {Command, flags} = require('@oclif/command');
2+
3+
class UninstallCommand extends Command {
4+
// static _base = 'thing';
5+
// static id = 'thing';
6+
// static title = 'title';
7+
8+
static description = `Describe the command here
9+
10+
Extra documentation goes here
11+
`;
12+
// static hidden - false;
13+
14+
static usage = 'stuff';
15+
16+
static help = 'stuff';
17+
18+
static aliases = ['uninstall'];
19+
20+
// static strict = false;
21+
// static parse = true;
22+
static flags = {
23+
name: flags.string({char: 'n', description: 'name to print'}),
24+
}
25+
26+
// static args
27+
// static plugin
28+
// static examples
29+
// static parserOptions
30+
// static
31+
32+
static flags = {
33+
name: flags.string({char: 'n', description: 'name to print'}),
34+
}
35+
36+
async run() {
37+
const {flags} = this.parse(UninstallCommand);
38+
const name = flags.name || 'world';
39+
this.log(`hello ${name} from ./src/commands/hello.js`);
40+
}
41+
}
42+
43+
module.exports = UninstallCommand;

cli/commands/list.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
const {Command, flags} = require('@oclif/command');
2+
3+
class UninstallCommand extends Command {
4+
// static _base = 'thing';
5+
// static id = 'thing';
6+
// static title = 'title';
7+
8+
static description = `Describe the command here
9+
10+
Extra documentation goes here
11+
`;
12+
// static hidden - false;
13+
14+
static usage = 'stuff';
15+
16+
static help = 'stuff';
17+
18+
static aliases = ['uninstall'];
19+
20+
// static strict = false;
21+
// static parse = true;
22+
static flags = {
23+
name: flags.string({char: 'n', description: 'name to print'}),
24+
}
25+
26+
// static args
27+
// static plugin
28+
// static examples
29+
// static parserOptions
30+
// static
31+
32+
static flags = {
33+
name: flags.string({char: 'n', description: 'name to print'}),
34+
}
35+
36+
async run() {
37+
const {flags} = this.parse(UninstallCommand);
38+
const name = flags.name || 'world';
39+
this.log(`hello ${name} from ./src/commands/hello.js`);
40+
}
41+
}
42+
43+
module.exports = UninstallCommand;

cli/commands/remove.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
const {Command, flags} = require('@oclif/command');
2+
3+
class UninstallCommand extends Command {
4+
// static _base = 'thing';
5+
// static id = 'thing';
6+
// static title = 'title';
7+
8+
static description = `Describe the command here
9+
10+
Extra documentation goes here
11+
`;
12+
// static hidden - false;
13+
14+
static usage = 'stuff';
15+
16+
static help = 'stuff';
17+
18+
static aliases = ['uninstall'];
19+
20+
// static strict = false;
21+
// static parse = true;
22+
static flags = {
23+
name: flags.string({char: 'n', description: 'name to print'}),
24+
}
25+
26+
// static args
27+
// static plugin
28+
// static examples
29+
// static parserOptions
30+
// static
31+
32+
static flags = {
33+
name: flags.string({char: 'n', description: 'name to print'}),
34+
}
35+
36+
async run() {
37+
const {flags} = this.parse(UninstallCommand);
38+
const name = flags.name || 'world';
39+
this.log(`hello ${name} from ./src/commands/hello.js`);
40+
}
41+
}
42+
43+
module.exports = UninstallCommand;

cli/commands/status.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
const {Command, flags} = require('@oclif/command');
2+
3+
class UninstallCommand extends Command {
4+
// static _base = 'thing';
5+
// static id = 'thing';
6+
// static title = 'title';
7+
8+
static description = `Describe the command here
9+
10+
Extra documentation goes here
11+
`;
12+
// static hidden - false;
13+
14+
static usage = 'stuff';
15+
16+
static help = 'stuff';
17+
18+
static aliases = ['uninstall'];
19+
20+
// static strict = false;
21+
// static parse = true;
22+
static flags = {
23+
name: flags.string({char: 'n', description: 'name to print'}),
24+
}
25+
26+
// static args
27+
// static plugin
28+
// static examples
29+
// static parserOptions
30+
// static
31+
32+
static flags = {
33+
name: flags.string({char: 'n', description: 'name to print'}),
34+
}
35+
36+
async run() {
37+
const {flags} = this.parse(UninstallCommand);
38+
const name = flags.name || 'world';
39+
this.log(`hello ${name} from ./src/commands/hello.js`);
40+
}
41+
}
42+
43+
module.exports = UninstallCommand;

cli/hooks/init.js

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ module.exports = async({id, argv, config}) => {
1616
require('debug').enable('*'); // eslint-disable-line node/no-extraneous-require
1717
debug('cli init start with id=%s, argv=%O', id, argv);
1818

19+
// if config cache exists then just load that and move on?
20+
1921
// Get config vars
2022
const ENV_PREFIX = process.env.HYPERDRIVE_BOOTSTRAP_ENV_PREFIX || 'HYPERDRIVE';
2123
const ENV_SEPARATOR = process.env.HYPERDRIVE_BOOTSTRAP_ENV_SEPARATOR || '_';
@@ -38,18 +40,40 @@ module.exports = async({id, argv, config}) => {
3840

3941
// Then defaults
4042
bootstrapConf.defaults({
41-
mode: 'cli',
42-
leia: Object.prototype.hasOwnProperty.call(process.env, 'LEIA_PARSER_RUNNING'),
43-
packaged: Object.prototype.hasOwnProperty.call(process, 'pkg'),
44-
plugins: [],
45-
pluginDirs: [],
4643
product: 'hyperdrive',
44+
mode: 'cli',
45+
bootstrap: {
46+
module: path.join(__dirname, '..', '..', 'utils', 'bootstrap.js'),
47+
env: {
48+
separator: '_',
49+
prefix: 'HYPERDRIVE',
50+
},
51+
landoPlugins: true,
52+
// @TODO: core plugin() below?
53+
/*
54+
plugins/core
55+
plugins/
56+
*/
57+
plugins: [],
58+
// @TODO:
59+
pluginDirs: [],
60+
},
4761
});
4862
debug('get config from defaults');
4963

64+
// @TODO: optionally add in lando plugin dirs?
65+
// @NOTE: this will need to do a light lando bootstrap to get plugin dirs and such
66+
// plugin manifests should be yaml eg dumpable to file
67+
5068
// Reset debugger to indicate product status
5169
debug = createDebugger(bootstrapConf.get('product'), 'hooks', 'init');
52-
debug('bootstrap config set to %O', bootstrapConf.get());
70+
debug('bootstrap config set to %O', bootstrapConf.get('source'));
71+
72+
// @TODO: load in oclif somewhere?
73+
// leia: Object.prototype.hasOwnProperty.call(process.env, 'LEIA_PARSER_RUNNING'),
74+
// packaged: Object.prototype.hasOwnProperty.call(process, 'pkg'),
75+
76+
// merge in some oclif stuff?
5377

5478
// 0. need to add plugins and plugin dirs to bootstrap config
5579
// 1. Check if bootstrap exists, throw error if not
@@ -72,22 +96,6 @@ module.exports = async({id, argv, config}) => {
7296
// *. what do commandIDs do?
7397
// *. install defaults eg desktop -> lando-desktop
7498
/*
75-
hyperdrive:
76-
config:
77-
// list of installers
78-
installers:
79-
80-
// Just OCLIF command objects, this is just a list of metadata
81-
commands:
82-
- {id: 'install', variant: 'lando-docker-engine', path: }
83-
84-
plugins:
85-
- pathtofunction -> gets config and returns plugin
86-
87-
// Final mods to commands, useful to add more options/args etc
88-
mods: (?)
89-
- {id: 'install', path: }
90-
9199
// commands = [require('./../more/bye')];
92100
// config.plugins.push(new DynamicPlugin(config))
93101
// console.log(config.plugins);

0 commit comments

Comments
 (0)