zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: _tmux: Avoid breakages if `tmux' is not installed
@ 2011-05-31 19:24 Frank Terbeck
  0 siblings, 0 replies; only message in thread
From: Frank Terbeck @ 2011-05-31 19:24 UTC (permalink / raw)
  To: zsh-workers; +Cc: Frank Terbeck

With this, _tmux will not attempt and sub-command completions if
tmux is not found in `$path'.

---

  I'm not entirely sure if this is the right thing to do[tm].

  Usually, you wouldn't expect people to try completions for programs
  they don't have installed, but apparently, some people do. ;-)

 Completion/Unix/Command/_tmux |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/Completion/Unix/Command/_tmux b/Completion/Unix/Command/_tmux
index e9977fb..5fb7219 100644
--- a/Completion/Unix/Command/_tmux
+++ b/Completion/Unix/Command/_tmux
@@ -1520,6 +1520,10 @@ function _tmux() {
                 _describe -t subcommands 'tmux commands and aliases' _tmux_commands -- _tmux_aliases
             fi
         else
+            if (( ${+commands[tmux]} == 0 )); then
+                _message '`tmux'\'' not found in $path; sub-cmd completions disabled.'
+                return 0
+            fi
             tmuxcommand="${words[1]}"
             if [[ -n ${_tmux_aliasmap[$tmuxcommand]} ]] ; then
                 tmuxcommand="${_tmux_aliasmap[$tmuxcommand]}"
-- 
1.7.5


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-05-31 19:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-31 19:24 PATCH: _tmux: Avoid breakages if `tmux' is not installed Frank Terbeck

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).