(opts, cmd, subCmd, npm)
| 252 | // the current word has a dash. |
| 253 | // Return the config names with the same number of dashes as the current word has. |
| 254 | const configCompl = (opts, cmd, subCmd, npm) => { |
| 255 | const word = opts.word |
| 256 | const split = word.match(/^(-+)((?:no-)*)(.*)$/) |
| 257 | const dashes = split[1] |
| 258 | const no = split[2] |
| 259 | |
| 260 | // Get custom definitions from the command/subcommand |
| 261 | const customDefs = getCustomDefinitions(cmd, subCmd, npm) |
| 262 | const customNames = getCustomConfigNames(customDefs) |
| 263 | |
| 264 | // If there are custom definitions, return only those (new feature) |
| 265 | // Otherwise, return empty array (historical behavior - no global flag completion) |
| 266 | if (customNames.length > 0) { |
| 267 | const flags = customNames.filter(name => isFlag(name, cmd, subCmd, npm)) |
| 268 | return customNames.map(c => dashes + c) |
| 269 | .concat(flags.map(f => dashes + (no || 'no-') + f)) |
| 270 | } |
| 271 | |
| 272 | return [] |
| 273 | } |
| 274 | |
| 275 | // expand with the valid values of various config values. |
| 276 | // not yet implemented. |
no test coverage detected