Skip to content

Commit a80b984

Browse files
authoredApr 19, 2022
Rework example to avoid graphql warnings (#1719)
* Rework example to avoid graphql warnings * Fix help text
1 parent acbbe18 commit a80b984

File tree

2 files changed

+11
-37
lines changed

2 files changed

+11
-37
lines changed
 

‎examples/argument.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
#!/usr/bin/env node
22

3-
// This example shows specifying the arguments using argument() function.
3+
// This example shows specifying the command arguments using argument() function.
44

55
// const { Command } = require('commander'); // (normal include)
66
const { Command } = require('../'); // include commander in git clone of commander repo
77
const program = new Command();
88

99
program
10-
.version('0.1.0')
11-
.argument('<username>', 'user to login')
12-
.argument('[password]', 'password for user, if required', 'no password given')
13-
.description('example program for argument')
14-
.action((username, password) => {
15-
console.log('username:', username);
16-
console.log('password:', password);
10+
.name('connect')
11+
.argument('<server>', 'connect to the specified server')
12+
.argument('[user]', 'user account for connection', 'guest')
13+
.description('Example program with argument descriptions')
14+
.action((server, user) => {
15+
console.log('server:', server);
16+
console.log('user:', user);
1717
});
1818

1919
program.parse();
2020

2121
// Try the following:
22-
// node arguments.js --help
23-
// node arguments.js user
24-
// node arguments.js user secret
22+
// node argument.js --help
23+
// node argument.js main.remote.site
24+
// node argument.js main.remote.site admin

‎examples/arguments.js

-26
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.