#1192·yargs

Incorrect completion

Author: coreyfarrellCreated Aug 3, 2018Updated Aug 2, 2026
Labelstriaged

Using latest yargs with test-script.js:

javascript
#!/usr/bin/env node
const yargs = require('yargs');

const {argv} = yargs
	.usage('$0 <cmd> [args]')
	.options({
		verbose: {
			alias: 'v',
			default: false,
			type: 'boolean',
			describe: 'Enable verbose mode.'
		}
	})
	.help();

Run './test-script.js --get-yargs-completions "-", it lists --version, --verboseand--help. The -v` option is not listed.

Run ./test-script.js --get-yargs-completions "--v", it lists --version and --help. The generated bash completion script filters out --help so with the completion script installed ./test-script.js --v<tab> fills in --version, ignoring --verbose