Skip to content

Commit

Permalink
Rework example to avoid graphql warnings (#1719)
Browse files Browse the repository at this point in the history
* Rework example to avoid graphql warnings

* Fix help text
  • Loading branch information
shadowspawn committed Apr 19, 2022
1 parent acbbe18 commit a80b984
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 37 deletions.
22 changes: 11 additions & 11 deletions examples/argument.js
@@ -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
26 changes: 0 additions & 26 deletions examples/arguments.js

This file was deleted.

0 comments on commit a80b984

Please sign in to comment.