Skip to content

Commit ddc962d

Browse files
Minor command line wording adjustments to better fit other SDKs (#224)
* Minor command line wording adjustments to better fit other SDKs * Additional command line wording adjustments
1 parent ff8ca8f commit ddc962d

File tree

4 files changed

+38
-39
lines changed

4 files changed

+38
-39
lines changed

samples/node/basic_discovery/index.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,65 +12,65 @@ const yargs = require('yargs');
1212
yargs.command('*', false, (yargs: any) => {
1313
yargs.option('ca_file', {
1414
alias: 'r',
15-
description: 'FILE: path to a Root CA certificate file in PEM format.',
15+
description: '<path>: path to a Root CA certificate file in PEM format (optional, system trust store used by default).',
1616
type: 'string',
1717
required: true
1818
})
1919
.option('cert', {
2020
alias: 'c',
21-
description: 'FILE: path to a PEM encoded certificate to use with mTLS',
21+
description: '<path>: path to a PEM encoded certificate to use with mTLS.',
2222
type: 'string',
2323
required: true
2424
})
2525
.option('key', {
2626
alias: 'k',
27-
description: 'FILE: Path to a PEM encoded private key that matches cert.',
27+
description: '<path>: Path to a PEM encoded private key that matches cert.',
2828
type: 'string',
2929
required: true
3030
})
3131
.option('thing_name', {
3232
alias: 'n',
33-
description: 'STRING: Targeted Thing name.',
33+
description: 'Targeted Thing name.',
3434
type: 'string',
3535
required: true
3636
})
3737
.option('topic', {
3838
alias: 't',
39-
description: 'STRING: Targeted topic',
39+
description: 'Targeted topic (optional).',
4040
type: 'string',
4141
default: 'test/topic'
4242
})
4343
.option('mode', {
4444
alias: 'm',
45-
description: 'STRING: [publish, subscribe, both]. Defaults to both',
45+
description: 'Mode options: [publish, subscribe, both] (optional).',
4646
type: 'string',
4747
default: 'both',
4848
choices: ['publish', 'subscribe', 'both']
4949
})
5050
.option('message', {
5151
alias: 'M',
52-
description: 'STRING: Message to publish.',
52+
description: 'Message to publish (optional).',
5353
type: 'string',
5454
default: 'Hello world!'
5555
})
5656
.option('region', {
57-
description: 'STRING: AWS Region.',
57+
description: 'AWS Region (optional).',
5858
type: 'string',
5959
default: 'us-east-1'
6060
})
61-
.option('max_pub_ops', {
62-
description: 'NUMBER: Maximum number of publishes to send',
61+
.option('count', {
62+
description: 'Maximum number of publishes to send (optional).',
6363
type: 'number',
6464
default: 10
6565
})
6666
.option('print_discover_resp_only', {
67-
description: 'BOOLEAN: Only print the response from Greengrass discovery',
67+
description: 'Only print the response from Greengrass discovery (optional).',
6868
type: 'boolean',
6969
default: false
7070
})
7171
.option('verbose', {
7272
alias: 'v',
73-
description: 'BOOLEAN: Verbose output',
73+
description: 'Verbose output (optional).',
7474
type: 'string',
7575
default: 'none',
7676
choices: ['fatal', 'error', 'warn', 'info', 'debug', 'trace', 'none']
@@ -152,15 +152,15 @@ async function execute_session(connection: mqtt.MqttClientConnection, argv: Args
152152
console.log(`Publish received. topic:"${topic}" dup:${dup} qos:${qos} retain:${retain}`);
153153
console.log(json);
154154
const message = JSON.parse(json);
155-
if (message.sequence == argv.max_pub_ops) {
155+
if (message.sequence == argv.count) {
156156
resolve();
157157
}
158158
}
159159
await connection.subscribe(argv.topic, mqtt.QoS.AtMostOnce, on_publish);
160160
}
161161

162162
if (argv.mode == 'both' || argv.mode == 'publish') {
163-
for (let op_idx = 0; op_idx < argv.max_pub_ops; ++op_idx) {
163+
for (let op_idx = 0; op_idx < argv.count; ++op_idx) {
164164
const publish = async () => {
165165
const msg = {
166166
message: argv.message,

samples/node/fleet_provisioning/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@ yargs.command('*', false, (yargs: any) => {
1818
yargs
1919
.option('csr_file', {
2020
alias: 'csr',
21-
description: 'FILE: Path to a CSR file in PEM format',
21+
description: '<path>: Path to a CSR file in PEM format.',
2222
type: 'string',
2323
required: false
2424
})
2525
.option('template_name', {
2626
alias: 't',
27-
description: 'STRING: Template Name',
27+
description: 'Template Name.',
2828
type: 'string',
2929
required: true
3030
})
3131
.option('template_parameters', {
3232
alias: 'tp',
33-
description: 'Template parameters json ',
33+
description: '<json>: Template parameters json.',
3434
type: 'string',
3535
required: false
3636
})

samples/node/pub_sub_pkcs11/index.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ yargs.command('*', false, (yargs: any) => {
3030
required: true,
3131
})
3232
.option('cert', {
33-
description: "Path to your certificate file in PEM format.",
33+
description: "<path>: Path to your certificate file in PEM format.",
3434
type: 'string',
3535
required: true,
3636
})
3737
.option('pkcs11_lib', {
38-
description: "Path to PKCS#11 library.",
38+
description: "<path>: Path to PKCS#11 library.",
3939
type: 'string',
4040
required: true,
4141
})
@@ -57,31 +57,31 @@ yargs.command('*', false, (yargs: any) => {
5757
type: 'string',
5858
})
5959
.option('ca_file', {
60-
description: "Path to a Root CA certificate file in PEM format.",
60+
description: "<path>: Path to a Root CA certificate file in PEM format (optional, system trust store used by default).",
6161
type: 'string',
6262
})
6363
.option('client_id', {
6464
description: "Client ID for MQTT connection.",
6565
type: 'string',
6666
})
6767
.option('topic', {
68-
description: "Topic to publish to",
68+
description: "Topic to publish to (optional)",
6969
type: 'string',
7070
default: 'test/topic'
7171
})
7272
.option('count', {
7373
default: 10,
7474
description: "Number of messages to publish/receive before exiting. " +
75-
"Specify 0 to run forever.",
75+
"Specify 0 to run forever (optional).",
7676
type: 'number',
7777
})
7878
.option('message', {
79-
description: "Message to publish.",
79+
description: "Message to publish (optional).",
8080
type: 'string',
8181
default: 'Hello world!'
8282
})
8383
.option('verbosity', {
84-
description: "The amount of detail in the logging output of the sample.",
84+
description: "The amount of detail in the logging output of the sample (optional).",
8585
type: 'string',
8686
choices: ['error', 'warn', 'info', 'debug', 'trace', 'none']
8787
})

samples/util/cli_args.js

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,25 @@ function add_connection_establishment_arguments(yargs) {
3030
yargs
3131
.option('endpoint', {
3232
alias: 'e',
33-
description: "Your AWS IoT custom endpoint, not including a port. " +
34-
"Ex: \"abcd123456wxyz-ats.iot.us-east-1.amazonaws.com\"",
33+
description: '<path>: Your AWS IoT custom endpoint, not including a port.',
3534
type: 'string',
3635
required: true
3736
})
3837
.option('ca_file', {
3938
alias: 'r',
40-
description: 'File path to a Root CA certificate file in PEM format.',
39+
description: '<path>: File path to a Root CA certificate file in PEM format (optional, system trust store used by default).',
4140
type: 'string',
4241
required: false
4342
})
4443
.option('cert', {
4544
alias: 'c',
46-
description: 'File path to a PEM encoded certificate to use with mTLS',
45+
description: '<path>: File path to a PEM encoded certificate to use with mTLS.',
4746
type: 'string',
4847
required: false
4948
})
5049
.option('key', {
5150
alias: 'k',
52-
description: 'File path to a PEM encoded private key that matches cert.',
51+
description: '<path>: File path to a PEM encoded private key that matches cert.',
5352
type: 'string',
5453
required: false
5554
})
@@ -63,35 +62,35 @@ function add_connection_establishment_arguments(yargs) {
6362
alias: 'W',
6463
default: false,
6564
description: 'To use a websocket instead of raw mqtt. If you specify this option you must set a region ' +
66-
'for signing (signing_region) that matches your endpoint.',
65+
'for signing (region) that matches your endpoint.',
6766
type: 'boolean',
6867
required: false
6968
})
70-
.option('signing_region', {
69+
.option('region', {
7170
alias: 's',
7271
default: 'us-east-1',
7372
description: 'If you specify --use_websocket, this ' +
7473
'is the region that will be used for computing the Sigv4 signature. This region must match the' +
75-
'AWS region in your endpoint.',
74+
'AWS region in your endpoint (optional).',
7675
type: 'string',
7776
required: false
7877
})
7978
.option('proxy_host', {
8079
alias: 'H',
81-
description: 'Hostname of the proxy to connect to',
80+
description: 'Hostname of the proxy to connect to (optional, required if --proxy_port is set).',
8281
type: 'string',
8382
required: false
8483
})
8584
.option('proxy_port', {
8685
alias: 'P',
8786
default: 8080,
88-
description: 'Port of the proxy to connect to.',
87+
description: 'Port of the proxy to connect to (optional, required if --proxy_host is set).',
8988
type: 'number',
9089
required: false
9190
})
9291
.option('verbosity', {
9392
alias: 'v',
94-
description: 'The amount of detail in the logging output of the sample.',
93+
description: 'The amount of detail in the logging output of the sample (optional).',
9594
type: 'string',
9695
default: 'none',
9796
choices: ['fatal', 'error', 'warn', 'info', 'debug', 'trace', 'none']
@@ -108,21 +107,21 @@ function add_pub_sub_arguments(yargs) {
108107
yargs
109108
.option('topic', {
110109
alias: 't',
111-
description: 'Topic to publish to',
110+
description: 'Topic to publish to (optional).',
112111
type: 'string',
113112
default: 'test/topic'
114113
})
115114
.option('count', {
116115
alias: 'n',
117116
default: 10,
118117
description: 'Number of messages to publish/receive before exiting. ' +
119-
'Specify 0 to run forever.',
118+
'Specify 0 to run forever (optional).',
120119
type: 'number',
121120
required: false
122121
})
123122
.option('message', {
124123
alias: 'M',
125-
description: 'Message to publish.',
124+
description: 'Message to publish (optional).',
126125
type: 'string',
127126
default: 'Hello world!'
128127
})
@@ -174,7 +173,7 @@ function apply_sample_arguments(argv) {
174173
*/
175174
function build_websocket_mqtt_connection_from_args(argv) {
176175
let config_builder = iot.AwsIotMqttConnectionConfigBuilder.new_with_websockets({
177-
region: argv.signing_region,
176+
region: argv.region,
178177
credentials_provider: auth.AwsCredentialsProvider.newDefault()
179178
});
180179

0 commit comments

Comments
 (0)