tests(Bash Completions): updates the bash completions to the new file completion fallback

This commit is contained in:
Kevin K 2018-02-13 11:12:53 -05:00
parent 79a210472c
commit cdfdbfffb5
No known key found for this signature in database
GPG key ID: 17218E4B3692F01A

View file

@ -71,7 +71,7 @@ static BASH: &'static str = r#"_myapp() {
case "${prev}" in
--case)
COMPREPLY=("<case>")
COMPREPLY=($(compgen -f ${cur}))
return 0
;;
*)
@ -189,8 +189,8 @@ complete -c myapp -n "__fish_using_command myapp help" -s h -l help -d 'Prints h
complete -c myapp -n "__fish_using_command myapp help" -s V -l version -d 'Prints version information'
"#;
#[cfg_attr(not(target_os = "windows"), allow(dead_code))]
#[cfg(not(target_os = "windows"))]
#[allow(dead_code)]
#[cfg(not(target_os="windows"))]
static POWERSHELL: &'static str = r#"
@('myapp', './myapp') | %{
Register-ArgumentCompleter -Native -CommandName $_ -ScriptBlock {
@ -241,8 +241,8 @@ static POWERSHELL: &'static str = r#"
}
"#;
#[cfg_attr(target_os = "windows", allow(dead_code))]
#[cfg(target_os = "windows")]
#[allow(dead_code)]
#[cfg(target_os="windows")]
static POWERSHELL: &'static str = r#"
@('myapp', './myapp', 'myapp.exe', '.\myapp', '.\myapp.exe', './myapp.exe') | %{
Register-ArgumentCompleter -Native -CommandName $_ -ScriptBlock {
@ -282,8 +282,8 @@ static POWERSHELL: &'static str = r#"
}
"#;
#[cfg_attr(not(target_os = "windows"), allow(dead_code))]
#[cfg(not(target_os = "windows"))]
#[allow(dead_code)]
#[cfg(not(target_os="windows"))]
static POWERSHELL_SPECIAL_CMDS: &'static str = r#"
@('my_app', './my_app') | %{
Register-ArgumentCompleter -Native -CommandName $_ -ScriptBlock {
@ -343,8 +343,8 @@ static POWERSHELL_SPECIAL_CMDS: &'static str = r#"
}
"#;
#[cfg_attr(target_os = "windows", allow(dead_code))]
#[cfg(target_os = "windows")]
#[allow(dead_code)]
#[cfg(target_os="windows")]
static POWERSHELL_SPECIAL_CMDS: &'static str = r#"
@('my_app', './my_app', 'my_app.exe', '.\my_app', '.\my_app.exe', './my_app.exe') | %{
Register-ArgumentCompleter -Native -CommandName $_ -ScriptBlock {
@ -621,7 +621,7 @@ static BASH_SPECIAL_CMDS: &'static str = r#"_my_app() {
case "${prev}" in
--config)
COMPREPLY=("<config>")
COMPREPLY=($(compgen -f ${cur}))
return 0
;;
*)
@ -640,7 +640,7 @@ static BASH_SPECIAL_CMDS: &'static str = r#"_my_app() {
case "${prev}" in
--case)
COMPREPLY=("<case>")
COMPREPLY=($(compgen -f ${cur}))
return 0
;;
*)
@ -742,63 +742,45 @@ fn build_app_with_name(s: &'static str) -> App<'static, 'static> {
App::new(s)
.about("Tests completions")
.arg(Arg::with_name("file").help("some input file"))
.subcommand(
SubCommand::with_name("test").about("tests things").arg(
Arg::with_name("case")
.long("case")
.takes_value(true)
.help("the case to test"),
),
)
.subcommand(SubCommand::with_name("test")
.about("tests things")
.arg(Arg::with_name("case")
.long("case")
.takes_value(true)
.help("the case to test")))
}
fn build_app_special_commands() -> App<'static, 'static> {
build_app_with_name("my_app")
.subcommand(
SubCommand::with_name("some_cmd")
.about("tests other things")
.arg(
Arg::with_name("config")
.long("--config")
.takes_value(true)
.help("the other case to test"),
),
)
.subcommand(SubCommand::with_name("some_cmd")
.about("tests other things")
.arg(Arg::with_name("config")
.long("--config")
.takes_value(true)
.help("the other case to test")))
.subcommand(SubCommand::with_name("some-cmd-with-hypens"))
}
fn build_app_special_help() -> App<'static, 'static> {
App::new("my_app")
.arg(
Arg::with_name("single-quotes")
.long("single-quotes")
.help("Can be 'always', 'auto', or 'never'"),
)
.arg(
Arg::with_name("double-quotes")
.long("double-quotes")
.help("Can be \"always\", \"auto\", or \"never\""),
)
.arg(
Arg::with_name("backticks")
.long("backticks")
.help("For more information see `echo test`"),
)
.arg(
Arg::with_name("backslash")
.long("backslash")
.help("Avoid '\\n'"),
)
.arg(
Arg::with_name("brackets")
.long("brackets")
.help("List packages [filter]"),
)
.arg(
Arg::with_name("expansions")
.long("expansions")
.help("Execute the shell command with $SHELL"),
)
.arg(Arg::with_name("single-quotes")
.long("single-quotes")
.help("Can be 'always', 'auto', or 'never'"))
.arg(Arg::with_name("double-quotes")
.long("double-quotes")
.help("Can be \"always\", \"auto\", or \"never\""))
.arg(Arg::with_name("backticks")
.long("backticks")
.help("For more information see `echo test`"))
.arg(Arg::with_name("backslash")
.long("backslash")
.help("Avoid '\\n'"))
.arg(Arg::with_name("brackets")
.long("brackets")
.help("List packages [filter]"))
.arg(Arg::with_name("expansions")
.long("expansions")
.help("Execute the shell command with $SHELL"))
}
#[test]