From dbf7b824f618ac0022e12c14b1b3bf0a95f5b05b Mon Sep 17 00:00:00 2001 From: Ben O'Hara Date: Sun, 17 Jun 2012 17:35:48 +1000 Subject: [PATCH] exit if required package is not installed to make the modules portable accross systems and not setup aliases that arnt required --- modules/dpkg/init.zsh | 4 ++++ modules/git/init.zsh | 4 ++++ modules/perl/init.zsh | 4 ++++ modules/rsync/init.zsh | 4 ++++ modules/screen/init.zsh | 4 ++++ modules/tmux/init.zsh | 4 ++++ 6 files changed, 24 insertions(+) diff --git a/modules/dpkg/init.zsh b/modules/dpkg/init.zsh index 1ba77470..4094c52a 100644 --- a/modules/dpkg/init.zsh +++ b/modules/dpkg/init.zsh @@ -7,6 +7,10 @@ # Sorin Ionescu # +if (( ! $+commands[dpkg] )); then + return 1 +fi + # Aliases alias as="aptitude -F \"* %p -> %d \n(%v/%V)\" --no-gui --disable-columns search" # Searches for a package. alias ad="sudo apt-get update" # Updates packages lists. diff --git a/modules/git/init.zsh b/modules/git/init.zsh index e3c3ac84..cf15851e 100644 --- a/modules/git/init.zsh +++ b/modules/git/init.zsh @@ -5,6 +5,10 @@ # Sorin Ionescu # +if (( ! $+commands[git] )); then + return 1 +fi + # Source module files. source "${0:h}/alias.zsh" source "${0:h}/hub.zsh" diff --git a/modules/perl/init.zsh b/modules/perl/init.zsh index c833bd8b..7a6329f4 100644 --- a/modules/perl/init.zsh +++ b/modules/perl/init.zsh @@ -5,6 +5,10 @@ # Sorin Ionescu # +if (( ! $+commands[perl] )); then + return 1 +fi + if [[ "$OSTYPE" == darwin* ]]; then # Perl is slow; cache its output. cache_file="${0:h}/cache.zsh" diff --git a/modules/rsync/init.zsh b/modules/rsync/init.zsh index e0f866a8..2117e20e 100644 --- a/modules/rsync/init.zsh +++ b/modules/rsync/init.zsh @@ -5,6 +5,10 @@ # Sorin Ionescu # +if (( ! $+commands[rsync] )); then + return 1 +fi + # Aliases _rsync_cmd='rsync --verbose --progress --human-readable --compress --archive --hard-links --one-file-system' diff --git a/modules/screen/init.zsh b/modules/screen/init.zsh index 8c0f1d57..f1275495 100644 --- a/modules/screen/init.zsh +++ b/modules/screen/init.zsh @@ -5,6 +5,10 @@ # Sorin Ionescu # +if (( ! $+commands[screen] )); then + return 1 +fi + # Aliases alias sl="screen -list" alias sn="screen -U -S" diff --git a/modules/tmux/init.zsh b/modules/tmux/init.zsh index c066ea98..7d3b266e 100644 --- a/modules/tmux/init.zsh +++ b/modules/tmux/init.zsh @@ -6,6 +6,10 @@ # Colin Hebert # +if (( ! $+commands[tmux] )); then + return 1 +fi + # Aliases alias ta="tmux attach-session" alias tl="tmux list-sessions"