scriptPath method
The file that the completion script of shell for the command name
is installed as.
Throws an ArgumentError if name is not a command name, see
isCommandName: as a path it would name a file elsewhere.
Implementation
String scriptPath(final CompletionShell shell, final String name) {
_checkCommandName(name);
return switch (shell) {
CompletionShell.bash => _path.join(
environment.valueOf('BASH_COMPLETION_USER_DIR') ??
_path.join(_dataHome, 'bash-completion'),
'completions',
name,
),
CompletionShell.zsh => _path.join(
_dataHome,
'zsh',
'site-functions',
'_$name',
),
CompletionShell.fish => _path.join(
_configHome,
'fish',
'completions',
'$name.fish',
),
CompletionShell.powershell => _path.join(
_path.dirname(_powerShellProfile),
'Completions',
'$name.ps1',
),
CompletionShell.carapace => _path.join(
_carapaceConfigDir,
'carapace',
'specs',
'$name.yaml',
),
};
}