Skip to content

Commit

Permalink
#178 Fixed autocompletion bug for subcommands in zsh. Autocomplete on…
Browse files Browse the repository at this point in the history
… zsh would show only the global command options even when a subcommand was specified. Autocompletion now works for nested subcommands.

Closes #178
  • Loading branch information
remkop committed Aug 28, 2017
1 parent 3bbd94b commit 79e57dd
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
9 changes: 9 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# picocli Release Notes

## 1.0.1 - Bugfix release.

### Summary: zsh autocompletion bugfix

This is the eleventh public release.
Picocli follows [semantic versioning](http://semver.org/).

- #178 Fixed autocompletion bug for subcommands in zsh. Autocomplete on zsh would show only the global command options even when a subcommand was specified. Autocompletion now works for nested subcommands.

## 1.0.0 - Bugfix and enhancements release.

### Summary: command line autocompletion, `-Dkey=value`-like Map options, parser tracing, stricter parsing, bugfixes
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/picocli/AutoComplete.java
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@ public boolean equals(Object obj) {
" declare -A tmp\n" +
" eval lArr1=(\"\\\"\\${$1[@]}\\\"\")\n" +
" eval lArr2=(\"\\\"\\${$2[@]}\\\"\")\n" +
" for i in \"${lArr1[@]}\";{ [ -n \"$i\" ] && ((++tmp['$i']));}\n" +
" for i in \"${lArr2[@]}\";{ [ -z \"${tmp[$i]}\" ] && return 1;}\n" +
" for i in \"${lArr1[@]}\";{ [ -n \"$i\" ] && ((++tmp[$i]));}\n" +
" for i in \"${lArr2[@]}\";{ [ -n \"$i\" ] && [ -z \"${tmp[$i]}\" ] && return 1;}\n" +
" return 0\n" +
"}\n" +
"\n";
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/picocli/AutoCompleteTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,8 @@ public void testAutoCompleteAppBothScriptFilesForceOverwrite() throws Exception
" declare -A tmp\n" +
" eval lArr1=(\"\\\"\\${$1[@]}\\\"\")\n" +
" eval lArr2=(\"\\\"\\${$2[@]}\\\"\")\n" +
" for i in \"${lArr1[@]}\";{ [ -n \"$i\" ] && ((++tmp['$i']));}\n" +
" for i in \"${lArr2[@]}\";{ [ -z \"${tmp[$i]}\" ] && return 1;}\n" +
" for i in \"${lArr1[@]}\";{ [ -n \"$i\" ] && ((++tmp[$i]));}\n" +
" for i in \"${lArr2[@]}\";{ [ -n \"$i\" ] && [ -z \"${tmp[$i]}\" ] && return 1;}\n" +
" return 0\n" +
"}\n" +
"\n" +
Expand Down
4 changes: 2 additions & 2 deletions src/test/resources/basic.bash
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ function ArrContains() {
declare -A tmp
eval lArr1=("\"\${$1[@]}\"")
eval lArr2=("\"\${$2[@]}\"")
for i in "${lArr1[@]}";{ [ -n "$i" ] && ((++tmp['$i']));}
for i in "${lArr2[@]}";{ [ -z "${tmp[$i]}" ] && return 1;}
for i in "${lArr1[@]}";{ [ -n "$i" ] && ((++tmp[$i]));}
for i in "${lArr2[@]}";{ [ -n "$i" ] && [ -z "${tmp[$i]}" ] && return 1;}
return 0
}

Expand Down
4 changes: 2 additions & 2 deletions src/test/resources/picocompletion-demo_completion
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ function ArrContains() {
declare -A tmp
eval lArr1=("\"\${$1[@]}\"")
eval lArr2=("\"\${$2[@]}\"")
for i in "${lArr1[@]}";{ [ -n "$i" ] && ((++tmp['$i']));}
for i in "${lArr2[@]}";{ [ -z "${tmp[$i]}" ] && return 1;}
for i in "${lArr1[@]}";{ [ -n "$i" ] && ((++tmp[$i]));}
for i in "${lArr2[@]}";{ [ -n "$i" ] && [ -z "${tmp[$i]}" ] && return 1;}
return 0
}

Expand Down

0 comments on commit 79e57dd

Please sign in to comment.