-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsiteglide-cli-modules.js
More file actions
executable file
·35 lines (30 loc) · 1.13 KB
/
siteglide-cli-modules.js
File metadata and controls
executable file
·35 lines (30 loc) · 1.13 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
#!/usr/bin/env node
const program = require('commander'),
Gateway = require('./lib/proxy'),
logger = require('./lib/logger'),
fetchAuthData = require('./lib/settings').fetchSettings,
version = require('./package.json').version;
program
.version(version, '-v, --version')
.name('siteglide-cli modules')
.usage('<env>')
.description('View a list of modules installed on the site.')
.arguments('[environment]', 'name of the environment. Example: staging')
.option('-c --config-file <config-file>', 'config file path', '.siteglide-config')
.action(async (environment, params) => {
process.env.CONFIG_FILE_PATH = params.configFile;
process.env.WITH_IMAGES = params.withAssets;
const authData = fetchAuthData(environment, program);
const gateway = new Gateway(authData);
gateway.listModules().then(response => {
if (!response.data || response.data.length === 0) {
logger.Info('There are no installed modules');
} else {
logger.Info('Installed modules:');
response.data.map(module => {
logger.Info(`\t- ${module}`, { hideTimestamp: true });
});
}
}).catch(logger.Debug);
});
program.parse(process.argv);