Skip to content

Commit 41b12cf

Browse files
authored
Use standard import in examples (#2168)
1 parent dd2d8fb commit 41b12cf

39 files changed

+39
-82
lines changed

examples/action-this.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

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

5-
// const { Command } = require('commander'); // (normal include)
6-
const { Command } = require('../'); // include commander in git clone of commander repo
5+
const { Command } = require('commander');
76
const program = new Command();
87

98
program

examples/alias.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

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

5-
// const { Command } = require('commander'); // (normal include)
6-
const { Command } = require('../'); // include commander in git clone of commander repo
5+
const { Command } = require('commander');
76
const program = new Command();
87

98
program

examples/argument.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
// This example shows specifying the command arguments using argument() function.
44

5-
// const { Command } = require('commander'); // (normal include)
6-
const { Command } = require('../'); // include commander in git clone of commander repo
5+
const { Command } = require('commander');
76
const program = new Command();
87

98
program

examples/arguments-custom-processing.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
// Custom argument processing
55
// You may specify a function to do custom processing of argument values.
66

7-
// const commander = require('commander'); // (normal include)
8-
const commander = require('../'); // include commander in git clone of commander repo
7+
const commander = require('commander');
98
const program = new commander.Command();
109

1110
function myParseInt(value, dummyPrevious) {

examples/arguments-extra.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

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

5-
// const commander = require('commander'); // (normal include)
6-
const commander = require('../'); // include commander in git clone of commander repo
5+
const commander = require('commander');
76
const program = new commander.Command();
87

98
program

examples/configure-help.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
// const commander = require('commander'); // (normal include)
2-
const commander = require('../'); // include commander in git clone of commander repo
3-
1+
const commander = require('commander');
42
const program = new commander.Command();
53

64
// This example shows a simple use of configureHelp.

examples/configure-output.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
// const commander = require('commander'); // (normal include)
2-
const commander = require('../'); // include commander in git clone of commander repo
3-
1+
const commander = require('commander');
42
const program = new commander.Command();
53

64
function errorColor(str) {

examples/custom-command-class.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#!/usr/bin/env node
2-
3-
// const commander = require('commander'); // (normal include)
4-
const commander = require('../'); // include commander in git clone of commander repo
2+
const commander = require('commander');
53

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

examples/custom-help

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
// This example shows a simple use of addHelpText.
44
// This is used as an example in the README.
55

6-
// const { Command } = require('commander'); // (normal include)
7-
const { Command } = require('../'); // include commander in git clone of commander repo
6+
const { Command } = require('commander');
87
const program = new Command();
98

109
program

examples/custom-help-description

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

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

5-
// const { Command } = require('commander'); // (normal include)
6-
const { Command } = require('../'); // include commander in git clone of commander repo
5+
const { Command } = require('commander');
76
const program = new Command();
87

98
program

examples/custom-help-text.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
// This example shows using addHelpText.
44

5-
// const { Command } = require('commander'); // (normal include)
6-
const { Command } = require('../'); // include commander in git clone of commander repo
5+
const { Command } = require('commander');
76
const program = new Command();
87

98
program.name('awesome');

examples/custom-version

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

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

5-
// const { Command } = require('commander'); // (normal include)
6-
const { Command } = require('../'); // include commander in git clone of commander repo
5+
const { Command } = require('commander');
76
const program = new Command();
87

98
program

examples/defaultCommand.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/env node
22

3-
// const commander = require('commander'); // (normal include)
4-
const commander = require('../'); // include commander in git clone of commander repo
3+
const commander = require('commander');
54
const program = new commander.Command();
65

76
// Example program using the command configuration option isDefault to specify the default command.

examples/deploy

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/env node
22

3-
// const { Command } = require('commander'); // (normal include)
4-
const { Command } = require('../'); // include commander in git clone of commander repo
3+
const { Command } = require('commander');
54
const program = new Command();
65

76
program

examples/description

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

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

5-
// const { Command } = require('commander'); // (normal include)
6-
const { Command } = require('../'); // include commander in git clone of commander repo
5+
const { Command } = require('commander');
76
const program = new Command();
87

98
program

examples/global-options-added.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
// (A different pattern for a "global" option is to add it to the root command, rather
1010
// than to the subcommand. See global-options-nested.js.)
1111

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

1514
// Common options can be added when subcommands are created by using a custom subclass.
1615
// If the options are unsorted in the help, these will appear first.

examples/global-options-nested.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66
// (A different pattern for a "global" option is to add it to the subcommands, rather
77
// than to the program. See global-options-added.js.)
88

9-
// const { Command } = require('commander'); // (normal include)
10-
const { Command } = require('../'); // include commander in git clone of commander repo
11-
9+
const { Command } = require('commander');
1210
const program = new Command();
1311

1412
program

examples/help-subcommands-usage.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// const commander = require('commander'); // (normal include)
2-
const commander = require('../'); // include commander in git clone of commander repo
1+
const commander = require('commander');
32

43
// By default the subcommand list includes a fairly simple usage. If you have added a custom usage
54
// to the subcommands you may wish to configure the help to show these instead.

examples/hook.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/env node
22

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

76
// This example shows using some hooks for life cycle events.

examples/nestedCommands.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/env node
22

3-
// const commander = require('commander'); // (normal include)
4-
const commander = require('../'); // include commander in git clone of commander repo
3+
const commander = require('commander');
54
const program = new commander.Command();
65

76
// Commander supports nested subcommands.

examples/options-boolean-or-value.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
// Other option types, flag|value
55
// You can specify an option which functions as a flag but may also take a value (declared using square brackets).
66

7-
// const commander = require('commander'); // (normal include)
8-
const commander = require('../'); // include commander in git clone of commander repo
7+
const commander = require('commander');
98
const program = new commander.Command();
109

1110
program

examples/options-common.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
// This is used as an example in the README for:
44
// Common option types, boolean and value
55

6-
// const commander = require('commander'); // (normal include)
7-
const commander = require('../'); // include commander in git clone of commander repo
6+
const commander = require('commander');
87
const program = new commander.Command();
98

109
program

examples/options-conflicts.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/usr/bin/env node
2-
// const { Command, Option } = require('commander'); // (normal include)
3-
const { Command, Option } = require('../'); // include commander in git clone of commander repo
2+
const { Command, Option } = require('commander');
43
const program = new Command();
54

65
// You can use .conflicts() with a single string, which is the camel-case name of the conflicting option.

examples/options-custom-processing.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
// Custom option processing
55
// You may specify a function to do custom processing of option values.
66

7-
// const commander = require('commander'); // (normal include)
8-
const commander = require('../'); // include commander in git clone of commander repo
7+
const commander = require('commander');
98
const program = new commander.Command();
109

1110
function myParseInt(value, dummyPrevious) {

examples/options-defaults.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
// This is used as an example in the README for:
44
// Default option value
55

6-
// const commander = require('commander'); // (normal include)
7-
const commander = require('../'); // include commander in git clone of commander repo
6+
const commander = require('commander');
87
const program = new commander.Command();
98

109
program

examples/options-env.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/usr/bin/env node
2-
// const { Command, Option } = require('commander'); // (normal include)
3-
const { Command, Option } = require('../'); // include commander in git clone of commander repo
2+
const { Command, Option } = require('commander');
43
const program = new Command();
54

65
program.addOption(new Option('-p, --port <number>', 'specify port number')

examples/options-extra.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
// See also options-env.js for more extensive env examples,
55
// and options-conflicts.js for more details about .conflicts().
66

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

1110
program

examples/options-implies.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/usr/bin/env node
2-
// const { Command, Option } = require('commander'); // (normal include)
3-
const { Command, Option } = require('../'); // include commander in git clone of commander repo
2+
const { Command, Option } = require('commander');
43
const program = new Command();
54

65
program

examples/options-negatable.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
// Other option types, negatable boolean
55
// You can specify a boolean option long name with a leading `no-` to make it true by default and able to be negated.
66

7-
// const commander = require('commander'); // (normal include)
8-
const commander = require('../'); // include commander in git clone of commander repo
7+
const commander = require('commander');
98
const program = new commander.Command();
109

1110
program

examples/options-required.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
// You may specify a required (mandatory) option using `.requiredOption`.
66
// The option must be specified on the command line, or by having a default value.
77

8-
// const commander = require('commander'); // (normal include)
9-
const commander = require('../'); // include commander in git clone of commander repo
8+
const commander = require('commander');
109
const program = new commander.Command();
1110

1211
program

examples/options-variadic.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

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

5-
// const commander = require('commander'); // (normal include)
6-
const commander = require('../'); // include commander in git clone of commander repo
5+
const commander = require('commander');
76
const program = new commander.Command();
87

98
program

examples/pass-through-options.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/env node
22

3-
// const { Command } = require('commander'); // (normal include)
4-
const { Command } = require('../'); // include commander in git clone of commander repo
3+
const { Command } = require('commander');
54
const program = new Command();
65

76
program

examples/pizza

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/env node
22

3-
// const { Command } = require('commander'); // (normal include)
4-
const { Command } = require('../'); // include commander in git clone of commander repo
3+
const { Command } = require('commander');
54
const program = new Command();
65

76
program

examples/pm

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/env node
22

3-
// const { Command } = require('commander'); // (normal include)
4-
const { Command } = require('../'); // include commander in git clone of commander repo
3+
const { Command } = require('commander');
54
const program = new Command();
65

76
// Example of subcommands which are implemented as stand-alone executable files.

examples/pm-install

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/env node
22

3-
// const { Command } = require('commander'); // (normal include)
4-
const { Command } = require('../'); // include commander in git clone of commander repo
3+
const { Command } = require('commander');
54
const program = new Command();
65

76
program

examples/positional-options.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/env node
22

3-
// const { Command } = require('commander'); // (normal include)
4-
const { Command } = require('../'); // include commander in git clone of commander repo
3+
const { Command } = require('commander');
54
const program = new Command();
65

76
program

examples/split.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// const { program } = require('commander'); // (normal include)
2-
const { program } = require('../'); // include commander in git clone of commander repo
1+
const { program } = require('commander');
32

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

examples/string-util.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// const { Command } = require('commander'); // (normal include)
2-
const { Command } = require('../'); // include commander in git clone of commander repo
1+
const { Command } = require('commander');
32
const program = new Command();
43

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

examples/thank.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

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

5-
// const { Command } = require('commander'); // (normal include)
6-
const { Command } = require('../'); // include commander in git clone of commander repo
5+
const { Command } = require('commander');
76
const program = new Command();
87

98
program

0 commit comments

Comments
 (0)