From 2cf1adb25130cc8836597760d8be97ab24ca9203 Mon Sep 17 00:00:00 2001 From: nebirhos Date: Sun, 25 Mar 2012 18:50:09 +0200 Subject: [PATCH] * Colorized uninstall output * Plugin tool improved --- tools/omz-plugin.sh | 19 ------------------- tools/plugin.sh | 43 +++++++++++++++++++++++++++++++++++++++++++ tools/uninstall.sh | 4 ++-- 3 files changed, 45 insertions(+), 21 deletions(-) delete mode 100755 tools/omz-plugin.sh create mode 100755 tools/plugin.sh mode change 100644 => 100755 tools/uninstall.sh diff --git a/tools/omz-plugin.sh b/tools/omz-plugin.sh deleted file mode 100755 index 65835aa68..000000000 --- a/tools/omz-plugin.sh +++ /dev/null @@ -1,19 +0,0 @@ -# Load plugin passed as first arg - -if [ -n "$1" ]; then - PLUGIN="$ZSH/plugins/$1" - - if [ -d $PLUGIN ]; then - fpath=($PLUGIN $fpath) - source $PLUGIN/*.plugin.zsh - autoload -U compinit - compinit -i - echo "$1 enabled!" - else - echo "Plugin '$1' not found!" - return 1 - fi -else - echo "Please specify a plugin" - return 1 -fi diff --git a/tools/plugin.sh b/tools/plugin.sh new file mode 100755 index 000000000..d1410afce --- /dev/null +++ b/tools/plugin.sh @@ -0,0 +1,43 @@ +#!/bin/zsh -x + +function omz_plugin_usage() { + echo "Usage: omz plugin [options] [plugin]" + echo "Enable [plugin] in current session" + echo + echo "Options" + echo " -l List available plugins" + echo " -h Show this help message" +} + + +while getopts ":lh" Option +do + case $Option in + l ) + ls $ZSH/plugins + return ;; + + * ) omz_plugin_usage + return 1 ;; + esac +done + + +if [ -n "$1" ]; then + PLUGIN="$ZSH/plugins/$1" + + if [ -d $PLUGIN ]; then + fpath=($PLUGIN $fpath) + source $PLUGIN/*.plugin.zsh + autoload -U compinit + compinit -i + echo "\033[0;32mPlugin $1 enabled" + return + else + echo "\033[1;31mPlugin $1 not found" + return 1 + fi +else + omz_plugin_usage; + return 1 +fi diff --git a/tools/uninstall.sh b/tools/uninstall.sh old mode 100644 new mode 100755 index 1b6cbebe3..e3f744f05 --- a/tools/uninstall.sh +++ b/tools/uninstall.sh @@ -1,7 +1,7 @@ #!/bin/zsh ### Better prompt the user! -echo -n "Are you sure to completely remove Oh My Zsh?" +echo -n "\033[0;33mAre you sure to completely remove Oh My Zsh?\033[0m" read "a? [type 'yes' to continue] " if [[ $a != "yes" ]]; then return 0 @@ -26,4 +26,4 @@ else source /etc/profile fi -echo "Thanks for trying out Oh My Zsh. It's been uninstalled." \ No newline at end of file +echo "Thanks for trying out Oh My Zsh. It's been uninstalled."