forked from 10up/wp-local-docker-v2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
executable file
·46 lines (37 loc) · 1.04 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env node
const yargs = require( 'yargs' );
const { checkIfConfigured, configureDefaults } = require( './src/configure' );
const { checkForUpdates } = require( './src/command-utils' );
async function bootstrap() {
// check configuration
const configured = await checkIfConfigured();
if ( configured === false ) {
await configureDefaults();
}
// check if a new version of the package exists
await checkForUpdates();
// usage and help flag
yargs.scriptName( 'wpdocker' );
yargs.usage( 'Usage: wpdocker <command>' );
yargs.wrap( Math.min( 150, yargs.terminalWidth() ) );
yargs.help( 'h' );
yargs.alias( 'h', 'help' );
yargs.alias( 'v', 'version' );
// global options
yargs.option( 'verbose', {
description: 'Display extended output',
default: false,
type: 'boolean',
} );
yargs.option( 'env', {
description: 'Environment name',
default: false,
type: 'string',
} );
// define commands, parse and process CLI args
yargs.commandDir( 'src/commands' );
yargs.demandCommand();
yargs.parse();
}
// start
bootstrap();