Skip to content

Commit

Permalink
feat: add autocomplete (#720)
Browse files Browse the repository at this point in the history
  • Loading branch information
rluvaton authored Aug 17, 2023
1 parent 4bf1e32 commit 6efa5ed
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 17 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ CLI tools for Node.js Core collaborators.
- [Setting up GitHub credentials](#setting-up-github-credentials)
- [Setting up Jenkins credentials](#setting-up-jenkins-credentials)
- [Make sure your credentials won't be committed](#make-sure-your-credentials-wont-be-committed)
- [Shell autocomplete](#shell-autocomplete)
- [Troubleshooting](#troubleshooting)
- [Contributing](#contributing)
- [License](#license)
Expand Down Expand Up @@ -130,6 +131,11 @@ serialized configurations.
If you ever accidentally commit your access token on GitHub, you can simply
revoke that token and use a new one.
### Shell autocomplete
To add autocomplete just run `git-node completion` and follow the instructions.
(same for the rest of the tools)
### Troubleshooting
If you encounter an error that you cannot fix by yourself, please
Expand Down
1 change: 1 addition & 0 deletions bin/git-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Promise.all(commandFiles.map(importCommand)).then((commands) => {
const args = yargs(hideBin(process.argv));
commands.forEach(command => args.command(command));
args.command('help', false, () => {}, (yargs) => { yargs.showHelp(); })
.completion('completion')
.demandCommand(1)
.strict()
.epilogue(epilogue)
Expand Down
1 change: 1 addition & 0 deletions bin/ncu-ci.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const commandKeys = [
];

const args = yargs(hideBin(process.argv))
.completion('completion')
.command({
command: 'rate <type>',
desc: 'Calculate the green rate of a CI job in the last 100 runs',
Expand Down
1 change: 1 addition & 0 deletions bin/ncu-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { setVerbosityFromEnv } from '../lib/verbosity.js';
setVerbosityFromEnv();

const args = yargs(hideBin(process.argv))
.completion('completion')
.command({
command: 'set <key> <value>',
desc: 'Set a config variable',
Expand Down
36 changes: 19 additions & 17 deletions bin/ncu-team.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,25 @@ import { setVerbosityFromEnv } from '../lib/verbosity.js';

setVerbosityFromEnv();

yargs(hideBin(process.argv)).command({
command: 'list <team> [org]',
desc: 'Get the list of members in a team',
builder: (yargs) => {
yargs
.positional('team', {
describe: 'Name of the team',
type: 'string'
})
.positional('org', {
describe: 'Name of the organization',
type: 'string',
default: 'nodejs'
});
},
handler
})
yargs(hideBin(process.argv))
.completion('completion')
.command({
command: 'list <team> [org]',
desc: 'Get the list of members in a team',
builder: (yargs) => {
yargs
.positional('team', {
describe: 'Name of the team',
type: 'string'
})
.positional('org', {
describe: 'Name of the organization',
type: 'string',
default: 'nodejs'
});
},
handler
})
.command({
command: 'sync <file>',
desc:
Expand Down

0 comments on commit 6efa5ed

Please sign in to comment.