-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdockerproxy-setup.js
More file actions
32 lines (29 loc) · 899 Bytes
/
dockerproxy-setup.js
File metadata and controls
32 lines (29 loc) · 899 Bytes
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
#! /usr/bin/env node
var commander = require('commander');
const configFile = require('./configFile');
const common = require('./common');
const dialog = require('./dialog');
commander
.name('dockerproxy setup')
.description('Setup this command line tool in order to use it without options')
.parse(process.argv);
// Throws Error if another argument is passed to the command
if (commander.args.length !== 0) {
common.error(
`This command does not accept any arguments.\nSee --help for a list of available options.`
);
process.exit(1);
}
if (configFile.isConfigured()) {
dialog.overwrite().then(function (overwrite) {
if (overwrite) {
dialog.askForConfig(configFile.readConfig()).then(function (config) {
configFile.writeConfig(config);
});
}
});
} else {
dialog.askForConfig().then(function (config) {
configFile.writeConfig(config);
});
}