-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework example to avoid graphql warnings (#1719)
* Rework example to avoid graphql warnings * Fix help text
- Loading branch information
1 parent
acbbe18
commit a80b984
Showing
2 changed files
with
11 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
#!/usr/bin/env node | ||
|
||
// This example shows specifying the arguments using argument() function. | ||
// This example shows specifying the command arguments using argument() function. | ||
|
||
// const { Command } = require('commander'); // (normal include) | ||
const { Command } = require('../'); // include commander in git clone of commander repo | ||
const program = new Command(); | ||
|
||
program | ||
.version('0.1.0') | ||
.argument('<username>', 'user to login') | ||
.argument('[password]', 'password for user, if required', 'no password given') | ||
.description('example program for argument') | ||
.action((username, password) => { | ||
console.log('username:', username); | ||
console.log('password:', password); | ||
.name('connect') | ||
.argument('<server>', 'connect to the specified server') | ||
.argument('[user]', 'user account for connection', 'guest') | ||
.description('Example program with argument descriptions') | ||
.action((server, user) => { | ||
console.log('server:', server); | ||
console.log('user:', user); | ||
}); | ||
|
||
program.parse(); | ||
|
||
// Try the following: | ||
// node arguments.js --help | ||
// node arguments.js user | ||
// node arguments.js user secret | ||
// node argument.js --help | ||
// node argument.js main.remote.site | ||
// node argument.js main.remote.site admin |
This file was deleted.
Oops, something went wrong.