forked from Siteglide/siteglide-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsiteglide-cli.js
More file actions
executable file
·50 lines (44 loc) · 1.78 KB
/
siteglide-cli.js
File metadata and controls
executable file
·50 lines (44 loc) · 1.78 KB
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
47
48
49
50
#!/usr/bin/env node
const program = require('commander'),
updateNotifier = require('update-notifier'),
pkg = require('./package.json'),
logger = require('./lib/logger'),
chalk = require('chalk'),
version = 'Siteglide CLI v' + pkg.version;
updateNotifier({
pkg: pkg
}).notify({
isGlobal: true,
defer: false,
message: 'Update available ' +
chalk.dim('{currentVersion}') +
chalk.reset(' → ') +
chalk.green('{latestVersion}') +
' \nRun ' + chalk.cyan('{updateCommand}') + ' to update' +
' \nChangelog: https://developers.siteglide.com/cli-changelog'
});
program
.version(version, '-v, --version')
.command('add [environment] --email [email] --url [url]', 'Add a site or environment')
.command('list', 'List your current environments for the site')
.command('sync [environment]', 'update site on local file change')
.command('pull [environment]', 'get all files from site')
.command('gui [environment]', 'gui for GraphiQL and Liquid Evaluator')
.command('logs [environment]', 'stream debugging logs from your website')
.command('init', 'create default folder structure for Siteglide Admin')
.command('deploy [environment]', 'upload all code to your site')
.command('export [environment]', 'export the code, assets and data from your site')
.command('migrate [environment] --url [url]', 'Static site migration into siteglide')
.command('modules [environment]', 'list modules installed on the site')
// .command('import [environment]', 'import your data.json to bulk upload all data')
.parse(process.argv);
var commandList = [];
program.commands.map(command => commandList.push(command._name));
if (!commandList.includes(program.args[0])) {
logger.Error(`unknown command: ${program.args[0]}`, {
exit: false
});
program.help();
process.exit(1);
}
if (!program.args.length) program.help();