-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathargs.js
More file actions
120 lines (102 loc) · 2.12 KB
/
Copy pathargs.js
File metadata and controls
120 lines (102 loc) · 2.12 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
'use strict';
const packageInfo = require('./package.json');
const { ArgumentParser } = require('argparse');
const parser = new ArgumentParser({
add_help: true,
description: 'Jake the dog and Finn the human'
});
parser.add_argument(
'-e', '--env',
{
help: 'Environment ( default value "dev" ). Relevant environment variable: JAKE_DEBUG',
default: 'dev'
}
);
parser.add_argument(
'-t', '--task',
{
help: 'Run task'
}
);
parser.add_argument(
'-d', '--docker-compose',
{
help: 'Execute "docker compose" command',
action: 'store_true'
}
);
parser.add_argument(
'-c', '--container',
{
help: 'Execute "docker compose [CONTAINER]" command'
}
);
parser.add_argument(
'-u', '--user',
{
help: 'Change docker container user'
}
);
parser.add_argument(
'-i', '--interactive',
{
help: 'Adds "--interactive" flag to "docker compose exec/run" commands',
action: 'store_true'
}
);
parser.add_argument(
'-T', '--tty',
{
help: 'Adds "--tty" flag to "docker compose exec/run" commands. Conflicts with "--auto-tty" option',
action: 'store_true'
}
);
parser.add_argument(
'--auto-tty',
{
help: 'Adds "--tty" flag to "docker compose exec/run" commands in tty terminal only. Conflicts with "--tty" option',
action: 'store_true'
}
);
parser.add_argument(
'-s', '--sh',
{
help: 'wrap command with \'sh -c "$cmd" \'',
action: 'store_true'
}
);
parser.add_argument(
'--terminate_timeout',
{
help: 'Child process terminating timeout. Relevant environment variable: JAKE_TERMINATE_TIMEOUT',
action: 'store',
default: 30
}
);
parser.add_argument(
'--debug',
{
help: 'Show debug information. Relevant environment variable: JAKE_DEBUG',
action: 'store_true'
}
);
parser.add_argument(
'--version',
{
help: 'show jake version',
action: 'version',
version: packageInfo.version
}
);
parser.add_argument(
'cmd',
{
help: 'command to execute',
nargs: '...'
}
);
const args = parser.parse_args();
if (args.tty && args.auto_tty) {
throw new Error('"--tty" and "--auto-tty" flags conflict');
}
module.exports = args;