A lot of flags have been added on the output of `docker help`. Use a
more robust method to extract the list of available subcommands by
spotting the `Command:` line and the next blank line.
Signed-off-by: Vincent Bernat <vincent@bernat.im>
| ... | ... |
@@ -177,7 +177,9 @@ __docker_commands () {
|
| 177 | 177 |
if ( [[ ${+_docker_subcommands} -eq 0 ]] || _cache_invalid docker_subcommands) \
|
| 178 | 178 |
&& ! _retrieve_cache docker_subcommands; |
| 179 | 179 |
then |
| 180 |
- _docker_subcommands=(${${${${(f)"$(_call_program commands docker 2>&1)"}[5,-1]}## #}/ ##/:})
|
|
| 180 |
+ local -a lines |
|
| 181 |
+ lines=(${(f)"$(_call_program commands docker 2>&1)"})
|
|
| 182 |
+ _docker_subcommands=(${${${lines[$((${lines[(i)Commands:]} + 1)),${lines[(I) *]}]}## #}/ ##/:})
|
|
| 181 | 183 |
_docker_subcommands=($_docker_subcommands 'help:Show help for a command') |
| 182 | 184 |
_store_cache docker_subcommands _docker_subcommands |
| 183 | 185 |
fi |