mirror of
https://github.com/clap-rs/clap
synced 2024-11-10 06:44:16 +00:00
fix(clap_complete): Add missing option hyphens to the listItemText parameter in PowerShell completions
This commit is contained in:
parent
16fba4b9f9
commit
10fd5fe8e3
12 changed files with 154 additions and 154 deletions
|
@ -131,7 +131,7 @@ fn generate_aliases(completions: &mut String, preamble: &String, arg: &Arg) {
|
|||
for alias in aliases {
|
||||
let _ = write!(
|
||||
completions,
|
||||
"{preamble}'-{alias}', '{alias}{}', [CompletionResultType]::ParameterName, '{tooltip}')",
|
||||
"{preamble}'-{alias}', '-{alias}{}', [CompletionResultType]::ParameterName, '{tooltip}')",
|
||||
// make PowerShell realize there is a difference between `-s` and `-S`
|
||||
if alias.is_uppercase() { " " } else { "" },
|
||||
);
|
||||
|
@ -142,7 +142,7 @@ fn generate_aliases(completions: &mut String, preamble: &String, arg: &Arg) {
|
|||
for alias in aliases {
|
||||
let _ = write!(
|
||||
completions,
|
||||
"{preamble}'--{alias}', '{alias}', [CompletionResultType]::ParameterName, '{tooltip}')"
|
||||
"{preamble}'--{alias}', '--{alias}', [CompletionResultType]::ParameterName, '{tooltip}')"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,18 +21,18 @@ Register-ArgumentCompleter -Native -CommandName 'my-app' -ScriptBlock {
|
|||
|
||||
$completions = @(switch ($command) {
|
||||
'my-app' {
|
||||
[CompletionResult]::new('-o', 'o', [CompletionResultType]::ParameterName, 'cmd option')
|
||||
[CompletionResult]::new('-O', 'O ', [CompletionResultType]::ParameterName, 'cmd option')
|
||||
[CompletionResult]::new('--option', 'option', [CompletionResultType]::ParameterName, 'cmd option')
|
||||
[CompletionResult]::new('--opt', 'opt', [CompletionResultType]::ParameterName, 'cmd option')
|
||||
[CompletionResult]::new('-f', 'f', [CompletionResultType]::ParameterName, 'cmd flag')
|
||||
[CompletionResult]::new('-F', 'F ', [CompletionResultType]::ParameterName, 'cmd flag')
|
||||
[CompletionResult]::new('--flag', 'flag', [CompletionResultType]::ParameterName, 'cmd flag')
|
||||
[CompletionResult]::new('--flg', 'flg', [CompletionResultType]::ParameterName, 'cmd flag')
|
||||
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('-V', 'V ', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('-o', '-o', [CompletionResultType]::ParameterName, 'cmd option')
|
||||
[CompletionResult]::new('-O', '-O ', [CompletionResultType]::ParameterName, 'cmd option')
|
||||
[CompletionResult]::new('--option', '--option', [CompletionResultType]::ParameterName, 'cmd option')
|
||||
[CompletionResult]::new('--opt', '--opt', [CompletionResultType]::ParameterName, 'cmd option')
|
||||
[CompletionResult]::new('-f', '-f', [CompletionResultType]::ParameterName, 'cmd flag')
|
||||
[CompletionResult]::new('-F', '-F ', [CompletionResultType]::ParameterName, 'cmd flag')
|
||||
[CompletionResult]::new('--flag', '--flag', [CompletionResultType]::ParameterName, 'cmd flag')
|
||||
[CompletionResult]::new('--flg', '--flg', [CompletionResultType]::ParameterName, 'cmd flag')
|
||||
[CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('-V', '-V ', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('--version', '--version', [CompletionResultType]::ParameterName, 'Print version')
|
||||
break
|
||||
}
|
||||
})
|
||||
|
|
|
@ -21,19 +21,19 @@ Register-ArgumentCompleter -Native -CommandName 'my-app' -ScriptBlock {
|
|||
|
||||
$completions = @(switch ($command) {
|
||||
'my-app' {
|
||||
[CompletionResult]::new('-c', 'c', [CompletionResultType]::ParameterName, 'c')
|
||||
[CompletionResult]::new('-v', 'v', [CompletionResultType]::ParameterName, 'v')
|
||||
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('-c', '-c', [CompletionResultType]::ParameterName, 'c')
|
||||
[CompletionResult]::new('-v', '-v', [CompletionResultType]::ParameterName, 'v')
|
||||
[CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('test', 'test', [CompletionResultType]::ParameterValue, 'Subcommand with a second line')
|
||||
[CompletionResult]::new('help', 'help', [CompletionResultType]::ParameterValue, 'Print this message or the help of the given subcommand(s)')
|
||||
break
|
||||
}
|
||||
'my-app;test' {
|
||||
[CompletionResult]::new('-d', 'd', [CompletionResultType]::ParameterName, 'd')
|
||||
[CompletionResult]::new('-c', 'c', [CompletionResultType]::ParameterName, 'c')
|
||||
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('-d', '-d', [CompletionResultType]::ParameterName, 'd')
|
||||
[CompletionResult]::new('-c', '-c', [CompletionResultType]::ParameterName, 'c')
|
||||
[CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
break
|
||||
}
|
||||
'my-app;help' {
|
||||
|
|
|
@ -21,19 +21,19 @@ Register-ArgumentCompleter -Native -CommandName 'bin-name' -ScriptBlock {
|
|||
|
||||
$completions = @(switch ($command) {
|
||||
'bin-name' {
|
||||
[CompletionResult]::new('-c', 'c', [CompletionResultType]::ParameterName, 'c')
|
||||
[CompletionResult]::new('-v', 'v', [CompletionResultType]::ParameterName, 'v')
|
||||
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('-c', '-c', [CompletionResultType]::ParameterName, 'c')
|
||||
[CompletionResult]::new('-v', '-v', [CompletionResultType]::ParameterName, 'v')
|
||||
[CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('test', 'test', [CompletionResultType]::ParameterValue, 'Subcommand with a second line')
|
||||
[CompletionResult]::new('help', 'help', [CompletionResultType]::ParameterValue, 'Print this message or the help of the given subcommand(s)')
|
||||
break
|
||||
}
|
||||
'bin-name;test' {
|
||||
[CompletionResult]::new('-d', 'd', [CompletionResultType]::ParameterName, 'd')
|
||||
[CompletionResult]::new('-c', 'c', [CompletionResultType]::ParameterName, 'c')
|
||||
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('-d', '-d', [CompletionResultType]::ParameterName, 'd')
|
||||
[CompletionResult]::new('-c', '-c', [CompletionResultType]::ParameterName, 'c')
|
||||
[CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
break
|
||||
}
|
||||
'bin-name;help' {
|
||||
|
|
|
@ -21,24 +21,24 @@ Register-ArgumentCompleter -Native -CommandName 'my-app' -ScriptBlock {
|
|||
|
||||
$completions = @(switch ($command) {
|
||||
'my-app' {
|
||||
[CompletionResult]::new('-c', 'c', [CompletionResultType]::ParameterName, 'some config file')
|
||||
[CompletionResult]::new('-C', 'C ', [CompletionResultType]::ParameterName, 'some config file')
|
||||
[CompletionResult]::new('--config', 'config', [CompletionResultType]::ParameterName, 'some config file')
|
||||
[CompletionResult]::new('--conf', 'conf', [CompletionResultType]::ParameterName, 'some config file')
|
||||
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('-V', 'V ', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('-c', '-c', [CompletionResultType]::ParameterName, 'some config file')
|
||||
[CompletionResult]::new('-C', '-C ', [CompletionResultType]::ParameterName, 'some config file')
|
||||
[CompletionResult]::new('--config', '--config', [CompletionResultType]::ParameterName, 'some config file')
|
||||
[CompletionResult]::new('--conf', '--conf', [CompletionResultType]::ParameterName, 'some config file')
|
||||
[CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('-V', '-V ', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('--version', '--version', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('test', 'test', [CompletionResultType]::ParameterValue, 'tests things')
|
||||
[CompletionResult]::new('help', 'help', [CompletionResultType]::ParameterValue, 'Print this message or the help of the given subcommand(s)')
|
||||
break
|
||||
}
|
||||
'my-app;test' {
|
||||
[CompletionResult]::new('--case', 'case', [CompletionResultType]::ParameterName, 'the case to test')
|
||||
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('-V', 'V ', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('--case', '--case', [CompletionResultType]::ParameterName, 'the case to test')
|
||||
[CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('-V', '-V ', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('--version', '--version', [CompletionResultType]::ParameterName, 'Print version')
|
||||
break
|
||||
}
|
||||
'my-app;help' {
|
||||
|
|
|
@ -21,16 +21,16 @@ Register-ArgumentCompleter -Native -CommandName 'my-app' -ScriptBlock {
|
|||
|
||||
$completions = @(switch ($command) {
|
||||
'my-app' {
|
||||
[CompletionResult]::new('--single-quotes', 'single-quotes', [CompletionResultType]::ParameterName, 'Can be ''always'', ''auto'', or ''never''')
|
||||
[CompletionResult]::new('--double-quotes', 'double-quotes', [CompletionResultType]::ParameterName, 'Can be "always", "auto", or "never"')
|
||||
[CompletionResult]::new('--backticks', 'backticks', [CompletionResultType]::ParameterName, 'For more information see `echo test`')
|
||||
[CompletionResult]::new('--backslash', 'backslash', [CompletionResultType]::ParameterName, 'Avoid ''\n''')
|
||||
[CompletionResult]::new('--brackets', 'brackets', [CompletionResultType]::ParameterName, 'List packages [filter]')
|
||||
[CompletionResult]::new('--expansions', 'expansions', [CompletionResultType]::ParameterName, 'Execute the shell command with $SHELL')
|
||||
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('-V', 'V ', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('--single-quotes', '--single-quotes', [CompletionResultType]::ParameterName, 'Can be ''always'', ''auto'', or ''never''')
|
||||
[CompletionResult]::new('--double-quotes', '--double-quotes', [CompletionResultType]::ParameterName, 'Can be "always", "auto", or "never"')
|
||||
[CompletionResult]::new('--backticks', '--backticks', [CompletionResultType]::ParameterName, 'For more information see `echo test`')
|
||||
[CompletionResult]::new('--backslash', '--backslash', [CompletionResultType]::ParameterName, 'Avoid ''\n''')
|
||||
[CompletionResult]::new('--brackets', '--brackets', [CompletionResultType]::ParameterName, 'List packages [filter]')
|
||||
[CompletionResult]::new('--expansions', '--expansions', [CompletionResultType]::ParameterName, 'Execute the shell command with $SHELL')
|
||||
[CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('-V', '-V ', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('--version', '--version', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('cmd-single-quotes', 'cmd-single-quotes', [CompletionResultType]::ParameterValue, 'Can be ''always'', ''auto'', or ''never''')
|
||||
[CompletionResult]::new('cmd-double-quotes', 'cmd-double-quotes', [CompletionResultType]::ParameterValue, 'Can be "always", "auto", or "never"')
|
||||
[CompletionResult]::new('cmd-backticks', 'cmd-backticks', [CompletionResultType]::ParameterValue, 'For more information see `echo test`')
|
||||
|
@ -41,33 +41,33 @@ Register-ArgumentCompleter -Native -CommandName 'my-app' -ScriptBlock {
|
|||
break
|
||||
}
|
||||
'my-app;cmd-single-quotes' {
|
||||
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
break
|
||||
}
|
||||
'my-app;cmd-double-quotes' {
|
||||
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
break
|
||||
}
|
||||
'my-app;cmd-backticks' {
|
||||
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
break
|
||||
}
|
||||
'my-app;cmd-backslash' {
|
||||
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
break
|
||||
}
|
||||
'my-app;cmd-brackets' {
|
||||
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
break
|
||||
}
|
||||
'my-app;cmd-expansions' {
|
||||
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
break
|
||||
}
|
||||
'my-app;help' {
|
||||
|
|
|
@ -21,14 +21,14 @@ Register-ArgumentCompleter -Native -CommandName 'my-app' -ScriptBlock {
|
|||
|
||||
$completions = @(switch ($command) {
|
||||
'my-app' {
|
||||
[CompletionResult]::new('-c', 'c', [CompletionResultType]::ParameterName, 'some config file')
|
||||
[CompletionResult]::new('-C', 'C ', [CompletionResultType]::ParameterName, 'some config file')
|
||||
[CompletionResult]::new('--config', 'config', [CompletionResultType]::ParameterName, 'some config file')
|
||||
[CompletionResult]::new('--conf', 'conf', [CompletionResultType]::ParameterName, 'some config file')
|
||||
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('-V', 'V ', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('-c', '-c', [CompletionResultType]::ParameterName, 'some config file')
|
||||
[CompletionResult]::new('-C', '-C ', [CompletionResultType]::ParameterName, 'some config file')
|
||||
[CompletionResult]::new('--config', '--config', [CompletionResultType]::ParameterName, 'some config file')
|
||||
[CompletionResult]::new('--conf', '--conf', [CompletionResultType]::ParameterName, 'some config file')
|
||||
[CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('-V', '-V ', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('--version', '--version', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('test', 'test', [CompletionResultType]::ParameterValue, 'tests things')
|
||||
[CompletionResult]::new('some_cmd', 'some_cmd', [CompletionResultType]::ParameterValue, 'tests other things')
|
||||
[CompletionResult]::new('some-cmd-with-hyphens', 'some-cmd-with-hyphens', [CompletionResultType]::ParameterValue, 'some-cmd-with-hyphens')
|
||||
|
@ -37,33 +37,33 @@ Register-ArgumentCompleter -Native -CommandName 'my-app' -ScriptBlock {
|
|||
break
|
||||
}
|
||||
'my-app;test' {
|
||||
[CompletionResult]::new('--case', 'case', [CompletionResultType]::ParameterName, 'the case to test')
|
||||
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('-V', 'V ', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('--case', '--case', [CompletionResultType]::ParameterName, 'the case to test')
|
||||
[CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('-V', '-V ', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('--version', '--version', [CompletionResultType]::ParameterName, 'Print version')
|
||||
break
|
||||
}
|
||||
'my-app;some_cmd' {
|
||||
[CompletionResult]::new('--config', 'config', [CompletionResultType]::ParameterName, 'the other case to test')
|
||||
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('-V', 'V ', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('--config', '--config', [CompletionResultType]::ParameterName, 'the other case to test')
|
||||
[CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('-V', '-V ', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('--version', '--version', [CompletionResultType]::ParameterName, 'Print version')
|
||||
break
|
||||
}
|
||||
'my-app;some-cmd-with-hyphens' {
|
||||
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('-V', 'V ', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('-V', '-V ', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('--version', '--version', [CompletionResultType]::ParameterName, 'Print version')
|
||||
break
|
||||
}
|
||||
'my-app;some-hidden-cmd' {
|
||||
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('-V', 'V ', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('-V', '-V ', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('--version', '--version', [CompletionResultType]::ParameterName, 'Print version')
|
||||
break
|
||||
}
|
||||
'my-app;help' {
|
||||
|
|
|
@ -21,14 +21,14 @@ Register-ArgumentCompleter -Native -CommandName 'my-app' -ScriptBlock {
|
|||
|
||||
$completions = @(switch ($command) {
|
||||
'my-app' {
|
||||
[CompletionResult]::new('-c', 'c', [CompletionResultType]::ParameterName, 'some config file')
|
||||
[CompletionResult]::new('-C', 'C ', [CompletionResultType]::ParameterName, 'some config file')
|
||||
[CompletionResult]::new('--config', 'config', [CompletionResultType]::ParameterName, 'some config file')
|
||||
[CompletionResult]::new('--conf', 'conf', [CompletionResultType]::ParameterName, 'some config file')
|
||||
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('-V', 'V ', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('-c', '-c', [CompletionResultType]::ParameterName, 'some config file')
|
||||
[CompletionResult]::new('-C', '-C ', [CompletionResultType]::ParameterName, 'some config file')
|
||||
[CompletionResult]::new('--config', '--config', [CompletionResultType]::ParameterName, 'some config file')
|
||||
[CompletionResult]::new('--conf', '--conf', [CompletionResultType]::ParameterName, 'some config file')
|
||||
[CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('-V', '-V ', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('--version', '--version', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('test', 'test', [CompletionResultType]::ParameterValue, 'tests things')
|
||||
[CompletionResult]::new('some_cmd', 'some_cmd', [CompletionResultType]::ParameterValue, 'top level subcommand')
|
||||
[CompletionResult]::new('some_cmd_alias', 'some_cmd_alias', [CompletionResultType]::ParameterValue, 'top level subcommand')
|
||||
|
@ -36,45 +36,45 @@ Register-ArgumentCompleter -Native -CommandName 'my-app' -ScriptBlock {
|
|||
break
|
||||
}
|
||||
'my-app;test' {
|
||||
[CompletionResult]::new('--case', 'case', [CompletionResultType]::ParameterName, 'the case to test')
|
||||
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('-V', 'V ', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('--case', '--case', [CompletionResultType]::ParameterName, 'the case to test')
|
||||
[CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('-V', '-V ', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('--version', '--version', [CompletionResultType]::ParameterName, 'Print version')
|
||||
break
|
||||
}
|
||||
'my-app;some_cmd' {
|
||||
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('-V', 'V ', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('-V', '-V ', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('--version', '--version', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('sub_cmd', 'sub_cmd', [CompletionResultType]::ParameterValue, 'sub-subcommand')
|
||||
[CompletionResult]::new('help', 'help', [CompletionResultType]::ParameterValue, 'Print this message or the help of the given subcommand(s)')
|
||||
break
|
||||
}
|
||||
'my-app;some_cmd_alias' {
|
||||
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('-V', 'V ', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('-V', '-V ', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('--version', '--version', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('sub_cmd', 'sub_cmd', [CompletionResultType]::ParameterValue, 'sub-subcommand')
|
||||
[CompletionResult]::new('help', 'help', [CompletionResultType]::ParameterValue, 'Print this message or the help of the given subcommand(s)')
|
||||
break
|
||||
}
|
||||
'my-app;some_cmd;sub_cmd' {
|
||||
[CompletionResult]::new('--config', 'config', [CompletionResultType]::ParameterName, 'the other case to test')
|
||||
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help (see more with ''--help'')')
|
||||
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help (see more with ''--help'')')
|
||||
[CompletionResult]::new('-V', 'V ', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('--config', '--config', [CompletionResultType]::ParameterName, 'the other case to test')
|
||||
[CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Print help (see more with ''--help'')')
|
||||
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Print help (see more with ''--help'')')
|
||||
[CompletionResult]::new('-V', '-V ', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('--version', '--version', [CompletionResultType]::ParameterName, 'Print version')
|
||||
break
|
||||
}
|
||||
'my-app;some_cmd_alias;sub_cmd' {
|
||||
[CompletionResult]::new('--config', 'config', [CompletionResultType]::ParameterName, 'the other case to test')
|
||||
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help (see more with ''--help'')')
|
||||
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help (see more with ''--help'')')
|
||||
[CompletionResult]::new('-V', 'V ', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('--config', '--config', [CompletionResultType]::ParameterName, 'the other case to test')
|
||||
[CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Print help (see more with ''--help'')')
|
||||
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Print help (see more with ''--help'')')
|
||||
[CompletionResult]::new('-V', '-V ', [CompletionResultType]::ParameterName, 'Print version')
|
||||
[CompletionResult]::new('--version', '--version', [CompletionResultType]::ParameterName, 'Print version')
|
||||
break
|
||||
}
|
||||
'my-app;some_cmd;help' {
|
||||
|
|
|
@ -21,21 +21,21 @@ Register-ArgumentCompleter -Native -CommandName 'my-app' -ScriptBlock {
|
|||
|
||||
$completions = @(switch ($command) {
|
||||
'my-app' {
|
||||
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('foo', 'foo', [CompletionResultType]::ParameterValue, 'foo')
|
||||
[CompletionResult]::new('bar', 'bar', [CompletionResultType]::ParameterValue, 'bar')
|
||||
[CompletionResult]::new('help', 'help', [CompletionResultType]::ParameterValue, 'Print this message or the help of the given subcommand(s)')
|
||||
break
|
||||
}
|
||||
'my-app;foo' {
|
||||
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
break
|
||||
}
|
||||
'my-app;bar' {
|
||||
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
break
|
||||
}
|
||||
'my-app;help' {
|
||||
|
|
|
@ -21,8 +21,8 @@ Register-ArgumentCompleter -Native -CommandName 'my-app' -ScriptBlock {
|
|||
|
||||
$completions = @(switch ($command) {
|
||||
'my-app' {
|
||||
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
break
|
||||
}
|
||||
})
|
||||
|
|
|
@ -21,28 +21,28 @@ Register-ArgumentCompleter -Native -CommandName 'my-app' -ScriptBlock {
|
|||
|
||||
$completions = @(switch ($command) {
|
||||
'my-app' {
|
||||
[CompletionResult]::new('--choice', 'choice', [CompletionResultType]::ParameterName, 'choice')
|
||||
[CompletionResult]::new('--unknown', 'unknown', [CompletionResultType]::ParameterName, 'unknown')
|
||||
[CompletionResult]::new('--other', 'other', [CompletionResultType]::ParameterName, 'other')
|
||||
[CompletionResult]::new('-p', 'p', [CompletionResultType]::ParameterName, 'p')
|
||||
[CompletionResult]::new('--path', 'path', [CompletionResultType]::ParameterName, 'path')
|
||||
[CompletionResult]::new('-f', 'f', [CompletionResultType]::ParameterName, 'f')
|
||||
[CompletionResult]::new('--file', 'file', [CompletionResultType]::ParameterName, 'file')
|
||||
[CompletionResult]::new('-d', 'd', [CompletionResultType]::ParameterName, 'd')
|
||||
[CompletionResult]::new('--dir', 'dir', [CompletionResultType]::ParameterName, 'dir')
|
||||
[CompletionResult]::new('-e', 'e', [CompletionResultType]::ParameterName, 'e')
|
||||
[CompletionResult]::new('--exe', 'exe', [CompletionResultType]::ParameterName, 'exe')
|
||||
[CompletionResult]::new('--cmd-name', 'cmd-name', [CompletionResultType]::ParameterName, 'cmd-name')
|
||||
[CompletionResult]::new('-c', 'c', [CompletionResultType]::ParameterName, 'c')
|
||||
[CompletionResult]::new('--cmd', 'cmd', [CompletionResultType]::ParameterName, 'cmd')
|
||||
[CompletionResult]::new('-u', 'u', [CompletionResultType]::ParameterName, 'u')
|
||||
[CompletionResult]::new('--user', 'user', [CompletionResultType]::ParameterName, 'user')
|
||||
[CompletionResult]::new('-H', 'H ', [CompletionResultType]::ParameterName, 'H')
|
||||
[CompletionResult]::new('--host', 'host', [CompletionResultType]::ParameterName, 'host')
|
||||
[CompletionResult]::new('--url', 'url', [CompletionResultType]::ParameterName, 'url')
|
||||
[CompletionResult]::new('--email', 'email', [CompletionResultType]::ParameterName, 'email')
|
||||
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--choice', '--choice', [CompletionResultType]::ParameterName, 'choice')
|
||||
[CompletionResult]::new('--unknown', '--unknown', [CompletionResultType]::ParameterName, 'unknown')
|
||||
[CompletionResult]::new('--other', '--other', [CompletionResultType]::ParameterName, 'other')
|
||||
[CompletionResult]::new('-p', '-p', [CompletionResultType]::ParameterName, 'p')
|
||||
[CompletionResult]::new('--path', '--path', [CompletionResultType]::ParameterName, 'path')
|
||||
[CompletionResult]::new('-f', '-f', [CompletionResultType]::ParameterName, 'f')
|
||||
[CompletionResult]::new('--file', '--file', [CompletionResultType]::ParameterName, 'file')
|
||||
[CompletionResult]::new('-d', '-d', [CompletionResultType]::ParameterName, 'd')
|
||||
[CompletionResult]::new('--dir', '--dir', [CompletionResultType]::ParameterName, 'dir')
|
||||
[CompletionResult]::new('-e', '-e', [CompletionResultType]::ParameterName, 'e')
|
||||
[CompletionResult]::new('--exe', '--exe', [CompletionResultType]::ParameterName, 'exe')
|
||||
[CompletionResult]::new('--cmd-name', '--cmd-name', [CompletionResultType]::ParameterName, 'cmd-name')
|
||||
[CompletionResult]::new('-c', '-c', [CompletionResultType]::ParameterName, 'c')
|
||||
[CompletionResult]::new('--cmd', '--cmd', [CompletionResultType]::ParameterName, 'cmd')
|
||||
[CompletionResult]::new('-u', '-u', [CompletionResultType]::ParameterName, 'u')
|
||||
[CompletionResult]::new('--user', '--user', [CompletionResultType]::ParameterName, 'user')
|
||||
[CompletionResult]::new('-H', '-H ', [CompletionResultType]::ParameterName, 'H')
|
||||
[CompletionResult]::new('--host', '--host', [CompletionResultType]::ParameterName, 'host')
|
||||
[CompletionResult]::new('--url', '--url', [CompletionResultType]::ParameterName, 'url')
|
||||
[CompletionResult]::new('--email', '--email', [CompletionResultType]::ParameterName, 'email')
|
||||
[CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
break
|
||||
}
|
||||
})
|
||||
|
|
|
@ -21,8 +21,8 @@ Register-ArgumentCompleter -Native -CommandName 'my-app' -ScriptBlock {
|
|||
|
||||
$completions = @(switch ($command) {
|
||||
'my-app' {
|
||||
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'Print help')
|
||||
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'Print help')
|
||||
break
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue