Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fba7c85

Browse files
committed
test(complete): Show newline issue
1 parent 8a7a13a commit fba7c85

18 files changed

Lines changed: 69 additions & 35 deletions

File tree

clap_complete/tests/snapshots/basic.elvish

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ set edit:completion:arg-completer[my-app] = {|@words|
2222
cand -v 'v'
2323
cand -h 'Print help'
2424
cand --help 'Print help'
25-
cand test 'Subcommand'
25+
cand test 'Subcommand
26+
with a second line'
2627
cand help 'Print this message or the help of the given subcommand(s)'
2728
}
2829
&'my-app;test'= {
@@ -32,7 +33,8 @@ set edit:completion:arg-completer[my-app] = {|@words|
3233
cand --help 'Print help'
3334
}
3435
&'my-app;help'= {
35-
cand test 'Subcommand'
36+
cand test 'Subcommand
37+
with a second line'
3638
cand help 'Print this message or the help of the given subcommand(s)'
3739
}
3840
&'my-app;help;test'= {
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
complete -c my-app -n "__fish_use_subcommand" -s c
22
complete -c my-app -n "__fish_use_subcommand" -s v
33
complete -c my-app -n "__fish_use_subcommand" -s h -l help -d 'Print help'
4-
complete -c my-app -n "__fish_use_subcommand" -f -a "test" -d 'Subcommand'
4+
complete -c my-app -n "__fish_use_subcommand" -f -a "test" -d 'Subcommand
5+
with a second line'
56
complete -c my-app -n "__fish_use_subcommand" -f -a "help" -d 'Print this message or the help of the given subcommand(s)'
67
complete -c my-app -n "__fish_seen_subcommand_from test" -s d
78
complete -c my-app -n "__fish_seen_subcommand_from test" -s c
89
complete -c my-app -n "__fish_seen_subcommand_from test" -s h -l help -d 'Print help'
9-
complete -c my-app -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from test; and not __fish_seen_subcommand_from help" -f -a "test" -d 'Subcommand'
10+
complete -c my-app -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from test; and not __fish_seen_subcommand_from help" -f -a "test" -d 'Subcommand
11+
with a second line'
1012
complete -c my-app -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from test; and not __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)'

clap_complete/tests/snapshots/basic.ps1

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ Register-ArgumentCompleter -Native -CommandName 'my-app' -ScriptBlock {
2525
[CompletionResult]::new('-v', 'v', [CompletionResultType]::ParameterName, 'v')
2626
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help')
2727
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help')
28-
[CompletionResult]::new('test', 'test', [CompletionResultType]::ParameterValue, 'Subcommand')
28+
[CompletionResult]::new('test', 'test', [CompletionResultType]::ParameterValue, 'Subcommand
29+
with a second line')
2930
[CompletionResult]::new('help', 'help', [CompletionResultType]::ParameterValue, 'Print this message or the help of the given subcommand(s)')
3031
break
3132
}
@@ -37,7 +38,8 @@ Register-ArgumentCompleter -Native -CommandName 'my-app' -ScriptBlock {
3738
break
3839
}
3940
'my-app;help' {
40-
[CompletionResult]::new('test', 'test', [CompletionResultType]::ParameterValue, 'Subcommand')
41+
[CompletionResult]::new('test', 'test', [CompletionResultType]::ParameterValue, 'Subcommand
42+
with a second line')
4143
[CompletionResult]::new('help', 'help', [CompletionResultType]::ParameterValue, 'Print this message or the help of the given subcommand(s)')
4244
break
4345
}

clap_complete/tests/snapshots/basic.zsh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,17 @@ esac
6868
(( $+functions[_my-app_commands] )) ||
6969
_my-app_commands() {
7070
local commands; commands=(
71-
'test:Subcommand' \
71+
'test:Subcommand
72+
with a second line' \
7273
'help:Print this message or the help of the given subcommand(s)' \
7374
)
7475
_describe -t commands 'my-app commands' commands "$@"
7576
}
7677
(( $+functions[_my-app__help_commands] )) ||
7778
_my-app__help_commands() {
7879
local commands; commands=(
79-
'test:Subcommand' \
80+
'test:Subcommand
81+
with a second line' \
8082
'help:Print this message or the help of the given subcommand(s)' \
8183
)
8284
_describe -t commands 'my-app help commands' commands "$@"

clap_complete/tests/snapshots/custom_bin_name.elvish

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ set edit:completion:arg-completer[bin-name] = {|@words|
2222
cand -v 'v'
2323
cand -h 'Print help'
2424
cand --help 'Print help'
25-
cand test 'Subcommand'
25+
cand test 'Subcommand
26+
with a second line'
2627
cand help 'Print this message or the help of the given subcommand(s)'
2728
}
2829
&'bin-name;test'= {
@@ -32,7 +33,8 @@ set edit:completion:arg-completer[bin-name] = {|@words|
3233
cand --help 'Print help'
3334
}
3435
&'bin-name;help'= {
35-
cand test 'Subcommand'
36+
cand test 'Subcommand
37+
with a second line'
3638
cand help 'Print this message or the help of the given subcommand(s)'
3739
}
3840
&'bin-name;help;test'= {
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
complete -c bin-name -n "__fish_use_subcommand" -s c
22
complete -c bin-name -n "__fish_use_subcommand" -s v
33
complete -c bin-name -n "__fish_use_subcommand" -s h -l help -d 'Print help'
4-
complete -c bin-name -n "__fish_use_subcommand" -f -a "test" -d 'Subcommand'
4+
complete -c bin-name -n "__fish_use_subcommand" -f -a "test" -d 'Subcommand
5+
with a second line'
56
complete -c bin-name -n "__fish_use_subcommand" -f -a "help" -d 'Print this message or the help of the given subcommand(s)'
67
complete -c bin-name -n "__fish_seen_subcommand_from test" -s d
78
complete -c bin-name -n "__fish_seen_subcommand_from test" -s c
89
complete -c bin-name -n "__fish_seen_subcommand_from test" -s h -l help -d 'Print help'
9-
complete -c bin-name -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from test; and not __fish_seen_subcommand_from help" -f -a "test" -d 'Subcommand'
10+
complete -c bin-name -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from test; and not __fish_seen_subcommand_from help" -f -a "test" -d 'Subcommand
11+
with a second line'
1012
complete -c bin-name -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from test; and not __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)'

clap_complete/tests/snapshots/custom_bin_name.ps1

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ Register-ArgumentCompleter -Native -CommandName 'bin-name' -ScriptBlock {
2525
[CompletionResult]::new('-v', 'v', [CompletionResultType]::ParameterName, 'v')
2626
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help')
2727
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help')
28-
[CompletionResult]::new('test', 'test', [CompletionResultType]::ParameterValue, 'Subcommand')
28+
[CompletionResult]::new('test', 'test', [CompletionResultType]::ParameterValue, 'Subcommand
29+
with a second line')
2930
[CompletionResult]::new('help', 'help', [CompletionResultType]::ParameterValue, 'Print this message or the help of the given subcommand(s)')
3031
break
3132
}
@@ -37,7 +38,8 @@ Register-ArgumentCompleter -Native -CommandName 'bin-name' -ScriptBlock {
3738
break
3839
}
3940
'bin-name;help' {
40-
[CompletionResult]::new('test', 'test', [CompletionResultType]::ParameterValue, 'Subcommand')
41+
[CompletionResult]::new('test', 'test', [CompletionResultType]::ParameterValue, 'Subcommand
42+
with a second line')
4143
[CompletionResult]::new('help', 'help', [CompletionResultType]::ParameterValue, 'Print this message or the help of the given subcommand(s)')
4244
break
4345
}

clap_complete/tests/snapshots/custom_bin_name.zsh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,17 @@ esac
6868
(( $+functions[_bin-name_commands] )) ||
6969
_bin-name_commands() {
7070
local commands; commands=(
71-
'test:Subcommand' \
71+
'test:Subcommand
72+
with a second line' \
7273
'help:Print this message or the help of the given subcommand(s)' \
7374
)
7475
_describe -t commands 'bin-name commands' commands "$@"
7576
}
7677
(( $+functions[_bin-name__help_commands] )) ||
7778
_bin-name__help_commands() {
7879
local commands; commands=(
79-
'test:Subcommand' \
80+
'test:Subcommand
81+
with a second line' \
8082
'help:Print this message or the help of the given subcommand(s)' \
8183
)
8284
_describe -t commands 'bin-name help commands' commands "$@"

clap_complete/tests/testsuite/common.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@ pub fn basic_command(name: &'static str) -> clap::Command {
1515
.action(clap::ArgAction::SetTrue),
1616
)
1717
.subcommand(
18-
clap::Command::new("test").about("Subcommand").arg(
19-
clap::Arg::new("debug")
20-
.short('d')
21-
.action(clap::ArgAction::Count),
22-
),
18+
clap::Command::new("test")
19+
.about("Subcommand\nwith a second line")
20+
.arg(
21+
clap::Arg::new("debug")
22+
.short('d')
23+
.action(clap::ArgAction::Count),
24+
),
2325
)
2426
}
2527

clap_complete_fig/tests/common.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@ pub fn basic_command(name: &'static str) -> clap::Command {
1313
.action(clap::ArgAction::SetTrue),
1414
)
1515
.subcommand(
16-
clap::Command::new("test").about("Subcommand").arg(
17-
clap::Arg::new("debug")
18-
.short('d')
19-
.action(clap::ArgAction::Count),
20-
),
16+
clap::Command::new("test")
17+
.about("Subcommand\nwith a second line")
18+
.arg(
19+
clap::Arg::new("debug")
20+
.short('d')
21+
.action(clap::ArgAction::Count),
22+
),
2123
)
2224
}
2325

0 commit comments

Comments
 (0)