Skip to content

Commit 6efa5ed

Browse files
authored
feat: add autocomplete (#720)
1 parent 4bf1e32 commit 6efa5ed

5 files changed

Lines changed: 28 additions & 17 deletions

File tree

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ CLI tools for Node.js Core collaborators.
1414
- [Setting up GitHub credentials](#setting-up-github-credentials)
1515
- [Setting up Jenkins credentials](#setting-up-jenkins-credentials)
1616
- [Make sure your credentials won't be committed](#make-sure-your-credentials-wont-be-committed)
17+
- [Shell autocomplete](#shell-autocomplete)
1718
- [Troubleshooting](#troubleshooting)
1819
- [Contributing](#contributing)
1920
- [License](#license)
@@ -130,6 +131,11 @@ serialized configurations.
130131
If you ever accidentally commit your access token on GitHub, you can simply
131132
revoke that token and use a new one.
132133

134+
### Shell autocomplete
135+
136+
To add autocomplete just run `git-node completion` and follow the instructions.
137+
(same for the rest of the tools)
138+
133139
### Troubleshooting
134140

135141
If you encounter an error that you cannot fix by yourself, please

bin/git-node.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Promise.all(commandFiles.map(importCommand)).then((commands) => {
2121
const args = yargs(hideBin(process.argv));
2222
commands.forEach(command => args.command(command));
2323
args.command('help', false, () => {}, (yargs) => { yargs.showHelp(); })
24+
.completion('completion')
2425
.demandCommand(1)
2526
.strict()
2627
.epilogue(epilogue)

bin/ncu-ci.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ const commandKeys = [
5353
];
5454

5555
const args = yargs(hideBin(process.argv))
56+
.completion('completion')
5657
.command({
5758
command: 'rate <type>',
5859
desc: 'Calculate the green rate of a CI job in the last 100 runs',

bin/ncu-config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { setVerbosityFromEnv } from '../lib/verbosity.js';
1111
setVerbosityFromEnv();
1212

1313
const args = yargs(hideBin(process.argv))
14+
.completion('completion')
1415
.command({
1516
command: 'set <key> <value>',
1617
desc: 'Set a config variable',

bin/ncu-team.js

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,25 @@ import { setVerbosityFromEnv } from '../lib/verbosity.js';
1313

1414
setVerbosityFromEnv();
1515

16-
yargs(hideBin(process.argv)).command({
17-
command: 'list <team> [org]',
18-
desc: 'Get the list of members in a team',
19-
builder: (yargs) => {
20-
yargs
21-
.positional('team', {
22-
describe: 'Name of the team',
23-
type: 'string'
24-
})
25-
.positional('org', {
26-
describe: 'Name of the organization',
27-
type: 'string',
28-
default: 'nodejs'
29-
});
30-
},
31-
handler
32-
})
16+
yargs(hideBin(process.argv))
17+
.completion('completion')
18+
.command({
19+
command: 'list <team> [org]',
20+
desc: 'Get the list of members in a team',
21+
builder: (yargs) => {
22+
yargs
23+
.positional('team', {
24+
describe: 'Name of the team',
25+
type: 'string'
26+
})
27+
.positional('org', {
28+
describe: 'Name of the organization',
29+
type: 'string',
30+
default: 'nodejs'
31+
});
32+
},
33+
handler
34+
})
3335
.command({
3436
command: 'sync <file>',
3537
desc:

0 commit comments

Comments
 (0)