From 99d87dc29e7156081e9027f172f870abf6ec1015 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Fri, 29 Jul 2022 19:34:31 -0300 Subject: [PATCH] Fix usage example - Actually parse the values into a COMPREPLY array --- src/main/java/picocli/AutoComplete.java | 2 +- src/test/java/picocli/AutoCompleteTest.java | 8 ++++---- src/test/resources/bashify_completion.bash | 2 +- src/test/resources/basic.bash | 2 +- src/test/resources/hyphenated_completion.bash | 2 +- .../resources/picocompletion-demo-help_completion.bash | 2 +- src/test/resources/picocompletion-demo_completion.bash | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/java/picocli/AutoComplete.java b/src/main/java/picocli/AutoComplete.java index 0800568b1..49ba5a16b 100644 --- a/src/main/java/picocli/AutoComplete.java +++ b/src/main/java/picocli/AutoComplete.java @@ -432,7 +432,7 @@ private static class CommandDescriptor { + "# Example usage:\n" + "# local options=(\"foo\", \"bar\", \"baz\")\n" + "# local IFS=$'\\n'\n" - + "# COMPREPLY=$(compReplyArray \"${options[@]}\")\n" + + + "# COMPREPLY=($(compReplyArray \"${options[@]}\"))\n" + "function compReplyArray() {\n" + " declare -a options\n" + " options=(\"$@\")\n" + diff --git a/src/test/java/picocli/AutoCompleteTest.java b/src/test/java/picocli/AutoCompleteTest.java index b3a1d9924..4c9a85c84 100644 --- a/src/test/java/picocli/AutoCompleteTest.java +++ b/src/test/java/picocli/AutoCompleteTest.java @@ -765,7 +765,7 @@ private String expectedCompletionScriptForAutoCompleteApp() { "# Example usage:\n" + "# local options=(\"foo\", \"bar\", \"baz\")\n" + "# local IFS=$'\\n'\n" + - "# COMPREPLY=$(compReplyArray \"${options[@]}\")\n" + + "# COMPREPLY=($(compReplyArray \"${options[@]}\"))\n" + "function compReplyArray() {\n" + " declare -a options\n" + " options=(\"$@\")\n" + @@ -1018,7 +1018,7 @@ private String expectedCompletionScriptForNonDefault() { "# Example usage:\n" + "# local options=(\"foo\", \"bar\", \"baz\")\n" + "# local IFS=$'\\n'\n" + - "# COMPREPLY=$(compReplyArray \"${options[@]}\")\n" + + "# COMPREPLY=($(compReplyArray \"${options[@]}\"))\n" + "function compReplyArray() {\n" + " declare -a options\n" + " options=(\"$@\")\n" + @@ -1619,7 +1619,7 @@ private String getCompletionScriptText(String cmdName) { "# Example usage:\n" + "# local options=(\"foo\", \"bar\", \"baz\")\n" + "# local IFS=$'\\n'\n" + - "# COMPREPLY=$(compReplyArray \"${options[@]}\")\n" + + "# COMPREPLY=($(compReplyArray \"${options[@]}\"))\n" + "function compReplyArray() {\n" + " declare -a options\n" + " options=(\"$@\")\n" + @@ -1866,7 +1866,7 @@ private String getCompletionScriptTextWithHidden(String commandName) { "# Example usage:\n" + "# local options=(\"foo\", \"bar\", \"baz\")\n" + "# local IFS=$'\\n'\n" + - "# COMPREPLY=$(compReplyArray \"${options[@]}\")\n" + + "# COMPREPLY=($(compReplyArray \"${options[@]}\"))\n" + "function compReplyArray() {\n" + " declare -a options\n" + " options=(\"$@\")\n" + diff --git a/src/test/resources/bashify_completion.bash b/src/test/resources/bashify_completion.bash index 5dfebaacf..693ef93bd 100644 --- a/src/test/resources/bashify_completion.bash +++ b/src/test/resources/bashify_completion.bash @@ -122,7 +122,7 @@ function currentPositionalIndex() { # Example usage: # local options=("foo", "bar", "baz") # local IFS=$'\n' -# COMPREPLY=$(compReplyArray "${options[@]}") +# COMPREPLY=($(compReplyArray "${options[@]}")) function compReplyArray() { declare -a options options=("$@") diff --git a/src/test/resources/basic.bash b/src/test/resources/basic.bash index 42e33a93d..f8fa5df25 100644 --- a/src/test/resources/basic.bash +++ b/src/test/resources/basic.bash @@ -122,7 +122,7 @@ function currentPositionalIndex() { # Example usage: # local options=("foo", "bar", "baz") # local IFS=$'\n' -# COMPREPLY=$(compReplyArray "${options[@]}") +# COMPREPLY=($(compReplyArray "${options[@]}")) function compReplyArray() { declare -a options options=("$@") diff --git a/src/test/resources/hyphenated_completion.bash b/src/test/resources/hyphenated_completion.bash index 0ebcdbe8c..60b40f8de 100644 --- a/src/test/resources/hyphenated_completion.bash +++ b/src/test/resources/hyphenated_completion.bash @@ -122,7 +122,7 @@ function currentPositionalIndex() { # Example usage: # local options=("foo", "bar", "baz") # local IFS=$'\n' -# COMPREPLY=$(compReplyArray "${options[@]}") +# COMPREPLY=($(compReplyArray "${options[@]}")) function compReplyArray() { declare -a options options=("$@") diff --git a/src/test/resources/picocompletion-demo-help_completion.bash b/src/test/resources/picocompletion-demo-help_completion.bash index 94512134c..101cd19de 100644 --- a/src/test/resources/picocompletion-demo-help_completion.bash +++ b/src/test/resources/picocompletion-demo-help_completion.bash @@ -122,7 +122,7 @@ function currentPositionalIndex() { # Example usage: # local options=("foo", "bar", "baz") # local IFS=$'\n' -# COMPREPLY=$(compReplyArray "${options[@]}") +# COMPREPLY=($(compReplyArray "${options[@]}")) function compReplyArray() { declare -a options options=("$@") diff --git a/src/test/resources/picocompletion-demo_completion.bash b/src/test/resources/picocompletion-demo_completion.bash index b773350be..1aa8e8115 100644 --- a/src/test/resources/picocompletion-demo_completion.bash +++ b/src/test/resources/picocompletion-demo_completion.bash @@ -122,7 +122,7 @@ function currentPositionalIndex() { # Example usage: # local options=("foo", "bar", "baz") # local IFS=$'\n' -# COMPREPLY=$(compReplyArray "${options[@]}") +# COMPREPLY=($(compReplyArray "${options[@]}")) function compReplyArray() { declare -a options options=("$@")