Skip to content

Commit

Permalink
Use standard import in examples (#2168)
Browse files Browse the repository at this point in the history
  • Loading branch information
shadowspawn committed Mar 12, 2024
1 parent dd2d8fb commit 41b12cf
Show file tree
Hide file tree
Showing 39 changed files with 39 additions and 82 deletions.
3 changes: 1 addition & 2 deletions examples/action-this.js
Expand Up @@ -2,8 +2,7 @@

// This example is used as an example in the README for the action handler.

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

program
Expand Down
3 changes: 1 addition & 2 deletions examples/alias.js
Expand Up @@ -2,8 +2,7 @@

// This example shows giving alternative names for a command.

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

program
Expand Down
3 changes: 1 addition & 2 deletions examples/argument.js
Expand Up @@ -2,8 +2,7 @@

// 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 { Command } = require('commander');
const program = new Command();

program
Expand Down
3 changes: 1 addition & 2 deletions examples/arguments-custom-processing.js
Expand Up @@ -4,8 +4,7 @@
// Custom argument processing
// You may specify a function to do custom processing of argument values.

// const commander = require('commander'); // (normal include)
const commander = require('../'); // include commander in git clone of commander repo
const commander = require('commander');
const program = new commander.Command();

function myParseInt(value, dummyPrevious) {
Expand Down
3 changes: 1 addition & 2 deletions examples/arguments-extra.js
Expand Up @@ -2,8 +2,7 @@

// This is used as an example in the README for extra argument features.

// const commander = require('commander'); // (normal include)
const commander = require('../'); // include commander in git clone of commander repo
const commander = require('commander');
const program = new commander.Command();

program
Expand Down
4 changes: 1 addition & 3 deletions examples/configure-help.js
@@ -1,6 +1,4 @@
// const commander = require('commander'); // (normal include)
const commander = require('../'); // include commander in git clone of commander repo

const commander = require('commander');
const program = new commander.Command();

// This example shows a simple use of configureHelp.
Expand Down
4 changes: 1 addition & 3 deletions examples/configure-output.js
@@ -1,6 +1,4 @@
// const commander = require('commander'); // (normal include)
const commander = require('../'); // include commander in git clone of commander repo

const commander = require('commander');
const program = new commander.Command();

function errorColor(str) {
Expand Down
4 changes: 1 addition & 3 deletions examples/custom-command-class.js
@@ -1,7 +1,5 @@
#!/usr/bin/env node

// const commander = require('commander'); // (normal include)
const commander = require('../'); // include commander in git clone of commander repo
const commander = require('commander');

// Use a class override to customise the command and its subcommands.

Expand Down
3 changes: 1 addition & 2 deletions examples/custom-help
Expand Up @@ -3,8 +3,7 @@
// This example shows a simple use of addHelpText.
// This is used as an example in the README.

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

program
Expand Down
3 changes: 1 addition & 2 deletions examples/custom-help-description
Expand Up @@ -2,8 +2,7 @@

// This example shows changing the flags and description for the help option.

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

program
Expand Down
3 changes: 1 addition & 2 deletions examples/custom-help-text.js
Expand Up @@ -2,8 +2,7 @@

// This example shows using addHelpText.

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

program.name('awesome');
Expand Down
3 changes: 1 addition & 2 deletions examples/custom-version
Expand Up @@ -2,8 +2,7 @@

// This example shows changing the flags and description for the version option.

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

program
Expand Down
3 changes: 1 addition & 2 deletions examples/defaultCommand.js
@@ -1,7 +1,6 @@
#!/usr/bin/env node

// const commander = require('commander'); // (normal include)
const commander = require('../'); // include commander in git clone of commander repo
const commander = require('commander');
const program = new commander.Command();

// Example program using the command configuration option isDefault to specify the default command.
Expand Down
3 changes: 1 addition & 2 deletions examples/deploy
@@ -1,7 +1,6 @@
#!/usr/bin/env node

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

program
Expand Down
3 changes: 1 addition & 2 deletions examples/description
Expand Up @@ -2,8 +2,7 @@

// This example shows adding a description which is displayed in the help.

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

program
Expand Down
3 changes: 1 addition & 2 deletions examples/global-options-added.js
Expand Up @@ -9,8 +9,7 @@
// (A different pattern for a "global" option is to add it to the root command, rather
// than to the subcommand. See global-options-nested.js.)

// const { Command } = require('commander'); // (normal include)
const { Command } = require('../'); // include commander in git clone of commander repo
const { Command } = require('commander');

// Common options can be added when subcommands are created by using a custom subclass.
// If the options are unsorted in the help, these will appear first.
Expand Down
4 changes: 1 addition & 3 deletions examples/global-options-nested.js
Expand Up @@ -6,9 +6,7 @@
// (A different pattern for a "global" option is to add it to the subcommands, rather
// than to the program. See global-options-added.js.)

// const { Command } = require('commander'); // (normal include)
const { Command } = require('../'); // include commander in git clone of commander repo

const { Command } = require('commander');
const program = new Command();

program
Expand Down
3 changes: 1 addition & 2 deletions examples/help-subcommands-usage.js
@@ -1,5 +1,4 @@
// const commander = require('commander'); // (normal include)
const commander = require('../'); // include commander in git clone of commander repo
const commander = require('commander');

// By default the subcommand list includes a fairly simple usage. If you have added a custom usage
// to the subcommands you may wish to configure the help to show these instead.
Expand Down
3 changes: 1 addition & 2 deletions examples/hook.js
@@ -1,7 +1,6 @@
#!/usr/bin/env node

// const commander = require('commander'); // (normal include)
const { Command, Option } = require('../'); // include commander in git clone of commander repo
const { Command, Option } = require('commander');
const program = new Command();

// This example shows using some hooks for life cycle events.
Expand Down
3 changes: 1 addition & 2 deletions examples/nestedCommands.js
@@ -1,7 +1,6 @@
#!/usr/bin/env node

// const commander = require('commander'); // (normal include)
const commander = require('../'); // include commander in git clone of commander repo
const commander = require('commander');
const program = new commander.Command();

// Commander supports nested subcommands.
Expand Down
3 changes: 1 addition & 2 deletions examples/options-boolean-or-value.js
Expand Up @@ -4,8 +4,7 @@
// Other option types, flag|value
// You can specify an option which functions as a flag but may also take a value (declared using square brackets).

// const commander = require('commander'); // (normal include)
const commander = require('../'); // include commander in git clone of commander repo
const commander = require('commander');
const program = new commander.Command();

program
Expand Down
3 changes: 1 addition & 2 deletions examples/options-common.js
Expand Up @@ -3,8 +3,7 @@
// This is used as an example in the README for:
// Common option types, boolean and value

// const commander = require('commander'); // (normal include)
const commander = require('../'); // include commander in git clone of commander repo
const commander = require('commander');
const program = new commander.Command();

program
Expand Down
3 changes: 1 addition & 2 deletions examples/options-conflicts.js
@@ -1,6 +1,5 @@
#!/usr/bin/env node
// const { Command, Option } = require('commander'); // (normal include)
const { Command, Option } = require('../'); // include commander in git clone of commander repo
const { Command, Option } = require('commander');
const program = new Command();

// You can use .conflicts() with a single string, which is the camel-case name of the conflicting option.
Expand Down
3 changes: 1 addition & 2 deletions examples/options-custom-processing.js
Expand Up @@ -4,8 +4,7 @@
// Custom option processing
// You may specify a function to do custom processing of option values.

// const commander = require('commander'); // (normal include)
const commander = require('../'); // include commander in git clone of commander repo
const commander = require('commander');
const program = new commander.Command();

function myParseInt(value, dummyPrevious) {
Expand Down
3 changes: 1 addition & 2 deletions examples/options-defaults.js
Expand Up @@ -3,8 +3,7 @@
// This is used as an example in the README for:
// Default option value

// const commander = require('commander'); // (normal include)
const commander = require('../'); // include commander in git clone of commander repo
const commander = require('commander');
const program = new commander.Command();

program
Expand Down
3 changes: 1 addition & 2 deletions examples/options-env.js
@@ -1,6 +1,5 @@
#!/usr/bin/env node
// const { Command, Option } = require('commander'); // (normal include)
const { Command, Option } = require('../'); // include commander in git clone of commander repo
const { Command, Option } = require('commander');
const program = new Command();

program.addOption(new Option('-p, --port <number>', 'specify port number')
Expand Down
3 changes: 1 addition & 2 deletions examples/options-extra.js
Expand Up @@ -4,8 +4,7 @@
// See also options-env.js for more extensive env examples,
// and options-conflicts.js for more details about .conflicts().

// const { Command, Option } = require('commander'); // (normal include)
const { Command, Option } = require('../'); // include commander in git clone of commander repo
const { Command, Option } = require('commander');
const program = new Command();

program
Expand Down
3 changes: 1 addition & 2 deletions examples/options-implies.js
@@ -1,6 +1,5 @@
#!/usr/bin/env node
// const { Command, Option } = require('commander'); // (normal include)
const { Command, Option } = require('../'); // include commander in git clone of commander repo
const { Command, Option } = require('commander');
const program = new Command();

program
Expand Down
3 changes: 1 addition & 2 deletions examples/options-negatable.js
Expand Up @@ -4,8 +4,7 @@
// Other option types, negatable boolean
// You can specify a boolean option long name with a leading `no-` to make it true by default and able to be negated.

// const commander = require('commander'); // (normal include)
const commander = require('../'); // include commander in git clone of commander repo
const commander = require('commander');
const program = new commander.Command();

program
Expand Down
3 changes: 1 addition & 2 deletions examples/options-required.js
Expand Up @@ -5,8 +5,7 @@
// You may specify a required (mandatory) option using `.requiredOption`.
// The option must be specified on the command line, or by having a default value.

// const commander = require('commander'); // (normal include)
const commander = require('../'); // include commander in git clone of commander repo
const commander = require('commander');
const program = new commander.Command();

program
Expand Down
3 changes: 1 addition & 2 deletions examples/options-variadic.js
Expand Up @@ -2,8 +2,7 @@

// This is used as an example in the README for variadic options.

// const commander = require('commander'); // (normal include)
const commander = require('../'); // include commander in git clone of commander repo
const commander = require('commander');
const program = new commander.Command();

program
Expand Down
3 changes: 1 addition & 2 deletions examples/pass-through-options.js
@@ -1,7 +1,6 @@
#!/usr/bin/env node

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

program
Expand Down
3 changes: 1 addition & 2 deletions examples/pizza
@@ -1,7 +1,6 @@
#!/usr/bin/env node

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

program
Expand Down
3 changes: 1 addition & 2 deletions examples/pm
@@ -1,7 +1,6 @@
#!/usr/bin/env node

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

// Example of subcommands which are implemented as stand-alone executable files.
Expand Down
3 changes: 1 addition & 2 deletions examples/pm-install
@@ -1,7 +1,6 @@
#!/usr/bin/env node

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

program
Expand Down
3 changes: 1 addition & 2 deletions examples/positional-options.js
@@ -1,7 +1,6 @@
#!/usr/bin/env node

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

program
Expand Down
3 changes: 1 addition & 2 deletions examples/split.js
@@ -1,5 +1,4 @@
// const { program } = require('commander'); // (normal include)
const { program } = require('../'); // include commander in git clone of commander repo
const { program } = require('commander');

// This is used as an example in the README for the Quick Start.

Expand Down
3 changes: 1 addition & 2 deletions examples/string-util.js
@@ -1,5 +1,4 @@
// const { Command } = require('commander'); // (normal include)
const { Command } = require('../'); // include commander in git clone of commander repo
const { Command } = require('commander');
const program = new Command();

// This is used as an example in the README for the Quick Start.
Expand Down
3 changes: 1 addition & 2 deletions examples/thank.js
Expand Up @@ -2,8 +2,7 @@

// This example is used as an example in the README for the action handler.

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

program
Expand Down

0 comments on commit 41b12cf

Please sign in to comment.