1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | 'use strict';
|
18 |
|
19 | const options = require('commander');
|
20 |
|
21 |
|
22 |
|
23 |
|
24 | module.exports = {
|
25 | |
26 |
|
27 |
|
28 |
|
29 |
|
30 | getCommonOptions(defaultLogFile) {
|
31 | options.reboot = true;
|
32 | options.port = 443;
|
33 |
|
34 |
|
35 | return options
|
36 | .version('4.23.0-beta.3')
|
37 | .option(
|
38 | '--host <ip_address>',
|
39 | 'Device management IP to which to send commands.'
|
40 | )
|
41 | .option(
|
42 | '-u, --user <user>',
|
43 | 'Device admin user name. Default is to create a temporary user (this only works when running on the device).'
|
44 | )
|
45 | .option(
|
46 | '-p, --password [password]',
|
47 | 'Device admin user password. Use this or --password-url. One of these is required when specifying the user.'
|
48 | )
|
49 | .option(
|
50 | '--password-url [password_url]',
|
51 | 'URL (file, http(s)) to location that contains device admin user password. Use this or --password. One of these is required when specifying the user.'
|
52 | )
|
53 | .option(
|
54 | '--password-encrypted',
|
55 | 'Indicates that the password is encrypted (either with encryptDataToFile or generatePassword)'
|
56 | )
|
57 | .option(
|
58 | '--port <port>',
|
59 | 'device management SSL port to connect to. Default 443.'
|
60 | )
|
61 | .option(
|
62 | '--no-reboot',
|
63 | 'Skip reboot even if it is recommended.'
|
64 | )
|
65 | .option(
|
66 | '--background',
|
67 | 'Spawn a background process to do the work. If you are running in cloud init, you probably want this option.'
|
68 | )
|
69 | .option(
|
70 | '--signal <signal>',
|
71 | 'Signal to send when done. Default ONBOARD_DONE.'
|
72 | )
|
73 | .option(
|
74 | '--wait-for <signal>',
|
75 | 'Wait for the named signal before running.'
|
76 | )
|
77 | .option(
|
78 | '--log-level <level>',
|
79 | 'Log level (none, error, warn, info, verbose, debug, silly). Default is info.', 'info'
|
80 | )
|
81 | .option(
|
82 | '-o, --output <file>',
|
83 | `Log to file as well as console. This is the default if background process is spawned. Default is ${defaultLogFile}`
|
84 | )
|
85 | .option(
|
86 | '-e, --error-file <file>',
|
87 | 'Log exceptions to a specific file. Default is /tmp/cloudLibsError.log, or cloudLibsError.log in --output file directory'
|
88 | )
|
89 | .option(
|
90 | '--no-console',
|
91 | 'Do not log to console. Default false (log to console).'
|
92 | );
|
93 |
|
94 | }
|
95 | };
|