66
}
67
}
69
>
const completions: string[] = [];
70
>
71
>
this.commandCompletions(completions, args, current);
72
>
this.optionCompletions(completions, args, argv, current);
73
>
this.choicesFromOptionsCompletions(completions, args, argv, current);
74
>
this.choicesFromPositionalsCompletions(completions, args, argv, current);
75
>
done(null, completions);
76
>
}
77
78
// Default completions for commands
79
private commandCompletions(
81
>
args: string[],
82
>
current: string
83
>
) {
84
>
const parentCommands = this.yargs
85
>
.getInternalMethods()
86
>
.getContext().commands;
87
>
if (
88
>
!current.match(/^-/) &&
89
>
parentCommands[parentCommands.length - 1] !== current &&
90
!this.previousArgHasChoices(args)
92
this.usage.getCommands().forEach(usageCommand => {
93
const commandName = parseCommand(usageCommand[0]).cmd;