diff options
| author | Daniel Shahaf <d.s@daniel.shahaf.name> | 2021-03-29 15:06:44 +0000 |
|---|---|---|
| committer | Daniel Shahaf <d.s@daniel.shahaf.name> | 2021-04-08 02:17:08 +0000 |
| commit | 295fbc0998db7204a9eb68f46c8bedab171ff387 (patch) | |
| tree | 5cbfb57de9535aab06e1c2458805283bbbd8428b | |
| parent | 48425: Add an XFail test for a 'zstyle -L' escaping bug (workers/48424). (diff) | |
| download | zsh-295fbc0998db7204a9eb68f46c8bedab171ff387.tar zsh-295fbc0998db7204a9eb68f46c8bedab171ff387.tar.gz zsh-295fbc0998db7204a9eb68f46c8bedab171ff387.tar.bz2 zsh-295fbc0998db7204a9eb68f46c8bedab171ff387.tar.lz zsh-295fbc0998db7204a9eb68f46c8bedab171ff387.tar.xz zsh-295fbc0998db7204a9eb68f46c8bedab171ff387.tar.zst zsh-295fbc0998db7204a9eb68f46c8bedab171ff387.zip | |
48321 (tweaked per thread): _perl_modules: Don't assume ${words[1]} to be either "perl" or "perldoc"
Also, correct an always-true condition guarding the fallback @INC
codepath.
| -rw-r--r-- | ChangeLog | 5 | ||||
| -rw-r--r-- | Completion/Unix/Type/_perl_modules | 11 |
2 files changed, 11 insertions, 5 deletions
@@ -1,3 +1,8 @@ +2021-04-08 Daniel Shahaf <d.s@daniel.shahaf.name> + + * 48321 (tweaked per thread): Completion/Unix/Type/_perl_modules: + Don't assume ${words[1]} to be either "perl" or "perldoc" + 2021-04-07 Daniel Shahaf <d.s@daniel.shahaf.name> * 48425: Test/V05styles.ztst: Add an XFail test for a 'zstyle diff --git a/Completion/Unix/Type/_perl_modules b/Completion/Unix/Type/_perl_modules index d27a7f7af..3e11de9ea 100644 --- a/Completion/Unix/Type/_perl_modules +++ b/Completion/Unix/Type/_perl_modules @@ -60,10 +60,11 @@ _perl_modules () { with_pod=_with_pod fi - local perl=${words[1]%doc} perl_modules - if whence $perl >/dev/null; then + local perl perl_modules + if [[ $service == (perl|perldoc) ]] && whence -- ${${(Q)words[1]}%doc} >/dev/null; then + perl=$_ perl_modules=_${${perl//[^[:alnum:]]/_}#_}_modules$with_pod - elif (( ${+commands[perl]} )); then + elif whence perl > /dev/null; then perl=perl perl_modules=_perl_modules$with_pod else @@ -81,8 +82,8 @@ _perl_modules () { else local inc libdir new_pms - if [[ ${+perl} -eq 1 ]]; then - inc=( $( $perl -e 'print "@INC"' ) ) + if [[ -n $perl ]]; then + inc=( $( _call_program perl-inc ${(q)perl}$' -e \'print "@INC"\'' ) ) else # If perl isn't there, one wonders why the user's trying to # complete Perl modules. Maybe her $path is wrong? |
