From ed2ef5a2b0480a56bc57abbccd2881eab1fc2ca1 Mon Sep 17 00:00:00 2001 From: Nathan Stilwell Date: Wed, 12 Apr 2017 00:28:27 -0400 Subject: [PATCH] Stripping out anything unused in .oh-my-zsh --- custom/corrections.zsh | 3 - custom/example.zsh | 5 - custom/example/example.plugin.zsh | 2 - lib/correction.zsh | 14 -- lib/edit-command-line.zsh | 3 - lib/functions.zsh | 9 - lib/key-bindings.zsh | 19 --- lib/misc.zsh | 15 -- lib/rbenv.zsh | 2 - lib/rvm.zsh | 8 - lib/theme-and-appearance.zsh | 15 +- oh-my-zsh.sh | 61 ++----- plugins/atlas/atlas.plugin.zsh | 5 +- ...{ace-of-spades.zsh-theme => ace-of-spades} | 7 +- themes/block-prompt-duotone-dark.zsh-theme | 7 +- themes/block-prompt.zsh-theme | 54 ------ tools/check_for_upgrade.sh | 52 ------ tools/install.sh | 32 ---- tools/require_tool.sh | 161 ------------------ tools/theme_chooser.sh | 97 ----------- tools/uninstall.sh | 28 --- tools/upgrade.sh | 16 -- 22 files changed, 21 insertions(+), 594 deletions(-) delete mode 100644 custom/corrections.zsh delete mode 100644 custom/example.zsh delete mode 100644 custom/example/example.plugin.zsh delete mode 100644 lib/correction.zsh delete mode 100644 lib/edit-command-line.zsh delete mode 100644 lib/misc.zsh delete mode 100644 lib/rbenv.zsh delete mode 100644 lib/rvm.zsh rename themes/{ace-of-spades.zsh-theme => ace-of-spades} (89%) delete mode 100644 themes/block-prompt.zsh-theme delete mode 100644 tools/check_for_upgrade.sh delete mode 100755 tools/install.sh delete mode 100755 tools/require_tool.sh delete mode 100755 tools/theme_chooser.sh delete mode 100644 tools/uninstall.sh delete mode 100644 tools/upgrade.sh diff --git a/custom/corrections.zsh b/custom/corrections.zsh deleted file mode 100644 index 2e78a9213..000000000 --- a/custom/corrections.zsh +++ /dev/null @@ -1,3 +0,0 @@ -alias figlet="nocorrect figlet" -alias rake="noglob rake" -alias ...="noglob ..." diff --git a/custom/example.zsh b/custom/example.zsh deleted file mode 100644 index 28ffcae25..000000000 --- a/custom/example.zsh +++ /dev/null @@ -1,5 +0,0 @@ -# Add yourself some shortcuts to projects you often work on -# Example: -# -# brainstormr=/Users/robbyrussell/Projects/development/planetargon/brainstormr -# \ No newline at end of file diff --git a/custom/example/example.plugin.zsh b/custom/example/example.plugin.zsh deleted file mode 100644 index 406f27445..000000000 --- a/custom/example/example.plugin.zsh +++ /dev/null @@ -1,2 +0,0 @@ -# Add your own custom plugins in the custom/plugins directory. Plugins placed -# here will override ones with the same name in the main plugins directory. diff --git a/lib/correction.zsh b/lib/correction.zsh deleted file mode 100644 index 436446101..000000000 --- a/lib/correction.zsh +++ /dev/null @@ -1,14 +0,0 @@ -if [[ "$DISABLE_CORRECTION" == "true" ]]; then - return -else - setopt correct_all - alias man='nocorrect man' - alias mv='nocorrect mv' - alias mysql='nocorrect mysql' - alias mkdir='nocorrect mkdir' - alias gist='nocorrect gist' - alias heroku='nocorrect heroku' - alias ebuild='nocorrect ebuild' - alias hpodder='nocorrect hpodder' - alias sudo='nocorrect sudo' -fi diff --git a/lib/edit-command-line.zsh b/lib/edit-command-line.zsh deleted file mode 100644 index db2000325..000000000 --- a/lib/edit-command-line.zsh +++ /dev/null @@ -1,3 +0,0 @@ -autoload -U edit-command-line -zle -N edit-command-line -bindkey '\C-x\C-e' edit-command-line diff --git a/lib/functions.zsh b/lib/functions.zsh index 63ab755cf..f167c3aa8 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -2,16 +2,7 @@ function zsh_stats() { history | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n20 } -function uninstall_oh_my_zsh() { - /usr/bin/env ZSH=$ZSH /bin/sh $ZSH/tools/uninstall.sh -} - -function upgrade_oh_my_zsh() { - /usr/bin/env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh -} - function take() { mkdir -p $1 cd $1 } - diff --git a/lib/key-bindings.zsh b/lib/key-bindings.zsh index 5f499f3e8..d9ede0859 100644 --- a/lib/key-bindings.zsh +++ b/lib/key-bindings.zsh @@ -29,22 +29,3 @@ bindkey '^?' backward-delete-char bindkey "^[[3~" delete-char bindkey "^[3;5~" delete-char bindkey "\e[3~" delete-char - -# consider emacs keybindings: - -#bindkey -e ## emacs key bindings -# -#bindkey '^[[A' up-line-or-search -#bindkey '^[[B' down-line-or-search -#bindkey '^[^[[C' emacs-forward-word -#bindkey '^[^[[D' emacs-backward-word -# -#bindkey -s '^X^Z' '%-^M' -#bindkey '^[e' expand-cmd-path -#bindkey '^[^I' reverse-menu-complete -#bindkey '^X^N' accept-and-infer-next-history -#bindkey '^W' kill-region -#bindkey '^I' complete-word -## Fix weird sequence that rxvt produces -#bindkey -s '^[[Z' '\t' -# diff --git a/lib/misc.zsh b/lib/misc.zsh deleted file mode 100644 index a8678b8ec..000000000 --- a/lib/misc.zsh +++ /dev/null @@ -1,15 +0,0 @@ -## smart urls -autoload -U url-quote-magic -zle -N self-insert url-quote-magic - -## file rename magick -bindkey "^[m" copy-prev-shell-word - -## jobs -setopt long_list_jobs - -## pager -export PAGER="less" -export LESS="-R" - -export LC_CTYPE=$LANG diff --git a/lib/rbenv.zsh b/lib/rbenv.zsh deleted file mode 100644 index a8b6c323c..000000000 --- a/lib/rbenv.zsh +++ /dev/null @@ -1,2 +0,0 @@ -# using the rbenv plugin will override this with a real implementation -function rbenv_prompt_info() {} diff --git a/lib/rvm.zsh b/lib/rvm.zsh deleted file mode 100644 index e8744e61e..000000000 --- a/lib/rvm.zsh +++ /dev/null @@ -1,8 +0,0 @@ -# get the name of the ruby version -function rvm_prompt_info() { - [ -f $HOME/.rvm/bin/rvm-prompt ] || return - local rvm_prompt - rvm_prompt=$($HOME/.rvm/bin/rvm-prompt ${ZSH_THEME_RVM_PROMPT_OPTIONS} 2>/dev/null) - [[ "${rvm_prompt}x" == "x" ]] && return - echo "${ZSH_THEME_RVM_PROMPT_PREFIX:=(}${rvm_prompt}${ZSH_THEME_RVM_PROMPT_SUFFIX:=)}" -} diff --git a/lib/theme-and-appearance.zsh b/lib/theme-and-appearance.zsh index 2677615c0..de03b305f 100644 --- a/lib/theme-and-appearance.zsh +++ b/lib/theme-and-appearance.zsh @@ -1,21 +1,9 @@ +#!/usr/bin/env zsh # ls colors autoload colors; colors; export LSCOLORS="Gxfxcxdxbxegedabagacad" #export LS_COLORS -# Enable ls colors -if [ "$DISABLE_LS_COLORS" != "true" ] -then - # Find the option for using colors in ls, depending on the version: Linux or BSD - if [[ "$(uname -s)" == "NetBSD" ]]; then - # On NetBSD, test if "gls" (GNU ls) is installed (this one supports colors); - # otherwise, leave ls as is, because NetBSD's ls doesn't support -G - gls --color -d . &>/dev/null 2>&1 && alias ls='gls --color=tty' - else - ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G' - fi -fi - #setopt no_beep setopt auto_cd setopt multios @@ -39,4 +27,3 @@ ZSH_THEME_GIT_PROMPT_CLEAN="" # Text to display if the branch is c # Setup the prompt with pretty colors setopt prompt_subst - diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 2ae07668c..ceb71dfb0 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -1,12 +1,7 @@ -# Check for updates on initial load... -if [ "$DISABLE_AUTO_UPDATE" != "true" ]; then - /usr/bin/env ZSH=$ZSH DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh $ZSH/tools/check_for_upgrade.sh -fi - -# Initializes Oh My Zsh +# Puppet Lair # add a function path -fpath=($ZSH/functions $ZSH/completions $fpath) +fpath=($ZSH/functions $fpath) # Load all of the config files in ~/oh-my-zsh that end in .zsh # TIP: Add files you don't want in git to .gitignore @@ -14,13 +9,6 @@ for config_file ($ZSH/lib/*.zsh); do source $config_file done -# Set ZSH_CUSTOM to the path where your custom config files -# and plugins exists, or else we will use the default custom/ -if [[ -z "$ZSH_CUSTOM" ]]; then - ZSH_CUSTOM="$ZSH/custom" -fi - - is_plugin() { local base_dir=$1 local name=$2 @@ -30,9 +18,7 @@ is_plugin() { # Add all defined plugins to fpath. This must be done # before running compinit. for plugin ($plugins); do - if is_plugin $ZSH_CUSTOM $plugin; then - fpath=($ZSH_CUSTOM/plugins/$plugin $fpath) - elif is_plugin $ZSH $plugin; then + if is_plugin $ZSH $plugin; then fpath=($ZSH/plugins/$plugin $fpath) fi done @@ -53,36 +39,13 @@ autoload -U compinit compinit -i -d "${ZSH_COMPDUMP}" # Load all of the plugins that were defined in ~/.zshrc -for plugin ($plugins); do - if [ -f $ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh ]; then - source $ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh - elif [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then - source $ZSH/plugins/$plugin/$plugin.plugin.zsh - fi -done +# for plugin ($plugins); do +# if [ -f $ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh ]; then +# source $ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh +# elif [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then +# source $ZSH/plugins/$plugin/$plugin.plugin.zsh +# fi +# done -# Load all of your custom configurations from custom/ -for config_file ($ZSH_CUSTOM/*.zsh(N)); do - source $config_file -done -unset config_file - -# Load the theme -if [ "$ZSH_THEME" = "random" ]; then - themes=($ZSH/themes/*zsh-theme) - N=${#themes[@]} - ((N=(RANDOM%N)+1)) - RANDOM_THEME=${themes[$N]} - source "$RANDOM_THEME" - echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..." -else - if [ ! "$ZSH_THEME" = "" ]; then - if [ -f "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme" ]; then - source "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme" - elif [ -f "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme" ]; then - source "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme" - else - source "$ZSH/themes/$ZSH_THEME.zsh-theme" - fi - fi -fi +# load theme +test -f "$ZSH/themes/$THEME" && source "$ZSH/themes/$THEME" diff --git a/plugins/atlas/atlas.plugin.zsh b/plugins/atlas/atlas.plugin.zsh index b34970f98..1140e769d 100644 --- a/plugins/atlas/atlas.plugin.zsh +++ b/plugins/atlas/atlas.plugin.zsh @@ -11,7 +11,6 @@ function atlas_usage { list show what host configs exist show show which config is linked - USAGE } @@ -46,7 +45,7 @@ function atlas_map { } function atlas_show { - if [ -d "/Users/nstilwell/.hosts" ] && [ -e "/Users/nstilwell/.hosts/$1" ]; then + if [ -d "/Users/nstilwell/.hosts" ] && [ -e "/Users/nstilwell/.hosts/" ]; then head -n 4 /etc/hosts; else echo "Atlas not initialized"; @@ -55,7 +54,7 @@ function atlas_show { } function atlas_list { - if [ -d "/Users/nstilwell/.hosts" ] && [ -e "/Users/nstilwell/.hosts/$1" ]; then + if [ -d "/Users/nstilwell/.hosts" ] && [ -e "/Users/nstilwell/.hosts/" ]; then ls -F ~/.hosts | grep -v /$; else echo "Atlas not initialized"; diff --git a/themes/ace-of-spades.zsh-theme b/themes/ace-of-spades similarity index 89% rename from themes/ace-of-spades.zsh-theme rename to themes/ace-of-spades index 816f18d91..7179f8ad7 100644 --- a/themes/ace-of-spades.zsh-theme +++ b/themes/ace-of-spades @@ -17,8 +17,8 @@ function ace_prompt () { local spade="♤ "; local fill_spade="♠︎ "; - ref=$(git symbolic-ref HEAD 2> /dev/null); - branch=${ref#refs/heads/}; + local ref=$(git symbolic-ref HEAD 2> /dev/null); + local branch=${ref#refs/heads/}; if [[ ! -z $branch ]]; then if [[ $branch == "master" ]]; then @@ -44,6 +44,8 @@ function ace_prompt () { unset prompt; unset red; unset blue; + unset branch; + unset ref; unset stop; } @@ -53,4 +55,3 @@ function directory () { PROMPT=' $(ace_prompt) $(collapse_pwd) > ' - diff --git a/themes/block-prompt-duotone-dark.zsh-theme b/themes/block-prompt-duotone-dark.zsh-theme index 872b241c8..b8907cc63 100644 --- a/themes/block-prompt-duotone-dark.zsh-theme +++ b/themes/block-prompt-duotone-dark.zsh-theme @@ -42,13 +42,10 @@ ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$BG[008]%}%{$fg[black]%} ✰ %{$reset_color%}" # # Convert the home directory to "~" # (Courtesy of Mr. Steve Losh) -#෴ +# function collapse_pwd { echo $(pwd | sed -e "s,^$HOME,~,") } -# -# Some Special Characters if you want to swap out the prompts -# ----------------------------------------------------------- -# ✰ ✼ ✪ ✙ ♔ ♘ ♜ ♛ ♚ ♞ ♬ ⏀ ⌦ ⌘ ≫ ⇪ ☩ ☀ ☂ ★ ⚓ Ө β δ Σ Ω μ Δ ↪ +# ✰ ✼ ✪ ✙ ♔ ♘ ☩ ★ diff --git a/themes/block-prompt.zsh-theme b/themes/block-prompt.zsh-theme deleted file mode 100644 index 872b241c8..000000000 --- a/themes/block-prompt.zsh-theme +++ /dev/null @@ -1,54 +0,0 @@ -# -# Available Color Options are : -# -# red, green, blue, cyan, magenta, yellow, white, black -# -# Reference to what stuff in the Prompt is: -# %n = username -# %~ = pwd -# %m = machine name -# - -# $FG[025] - dark blue -# $FG[050] - cyan -# $FG[075] - light blue -# $FG[100] - muddy yellow -# $FG[125] - strawberry -# $FG[145] - white - -PROMPT='%{$BG[237]%}%{$fg[white]%} $(hostname) \ -%{$BG[008]%}%{$fg[white]%} $(collapse_pwd) \ -%{$BG[056]%}%{$fg[white]%}$(git_prompt_short_sha)\ -%{$BG[093]%}%{$fg[white]%}$(git_prompt_info)\ -%{$reset_color%}$(git_prompt_status) -%{$reset_color%}> ' - -ZSH_THEME_GIT_PROMPT_SHA_BEFORE=" " -ZSH_THEME_GIT_PROMPT_SHA_AFTER=" " -ZSH_THEME_GIT_PROMPT_PREFIX=" ⑀ " -ZSH_THEME_GIT_PROMPT_SUFFIX="" -ZSH_THEME_GIT_PROMPT_DIRTY=" %{$bg[yellow]%}%{$fg[black]%} ⸭ " -ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[white]%} ☩ " - -# RPROMPT='$(git_prompt_status) %{$reset_color%}' - -ZSH_THEME_GIT_PROMPT_ADDED="%{$BG[010]%}%{$fg[black]%} ✰ %{$reset_color%}" -ZSH_THEME_GIT_PROMPT_MODIFIED="%{$BG[012]%}%{$fg[black]%} ✰ %{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DELETED="%{$BG[009]%}%{$fg[black]%} ✰ %{$reset_color%}" -ZSH_THEME_GIT_PROMPT_RENAMED="%{$BG[011]%}%{$fg[black]%} ✰ %{$reset_color%}" -ZSH_THEME_GIT_PROMPT_UNMERGED="%{$BG[014]%}%{$fg[black]%} ✰ %{$reset_color%}" -ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$BG[008]%}%{$fg[black]%} ✰ %{$reset_color%}" - -# -# Convert the home directory to "~" -# (Courtesy of Mr. Steve Losh) -#෴ - -function collapse_pwd { - echo $(pwd | sed -e "s,^$HOME,~,") -} - -# -# Some Special Characters if you want to swap out the prompts -# ----------------------------------------------------------- -# ✰ ✼ ✪ ✙ ♔ ♘ ♜ ♛ ♚ ♞ ♬ ⏀ ⌦ ⌘ ≫ ⇪ ☩ ☀ ☂ ★ ⚓ Ө β δ Σ Ω μ Δ ↪ diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh deleted file mode 100644 index 581f03a07..000000000 --- a/tools/check_for_upgrade.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/sh - -function _current_epoch() { - echo $(($(date +%s) / 60 / 60 / 24)) -} - -function _update_zsh_update() { - echo "LAST_EPOCH=$(_current_epoch)" > ~/.zsh-update -} - -function _upgrade_zsh() { - /usr/bin/env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh - # update the zsh file - _update_zsh_update -} - -epoch_target=$UPDATE_ZSH_DAYS -if [[ -z "$epoch_target" ]]; then - # Default to old behavior - epoch_target=13 -fi - -if [ -f ~/.zsh-update ] -then - . ~/.zsh-update - - if [[ -z "$LAST_EPOCH" ]]; then - _update_zsh_update && return 0; - fi - - epoch_diff=$(($(_current_epoch) - $LAST_EPOCH)) - if [ $epoch_diff -gt $epoch_target ] - then - if [ "$DISABLE_UPDATE_PROMPT" = "true" ] - then - _upgrade_zsh - else - echo "[Oh My Zsh] Would you like to check for updates?" - echo "Type Y to update oh-my-zsh: \c" - read line - if [ "$line" = Y ] || [ "$line" = y ]; then - _upgrade_zsh - else - _update_zsh_update - fi - fi - fi -else - # create the zsh file - _update_zsh_update -fi - diff --git a/tools/install.sh b/tools/install.sh deleted file mode 100755 index 05b2ee845..000000000 --- a/tools/install.sh +++ /dev/null @@ -1,32 +0,0 @@ -if [ -d ~/.oh-my-zsh ] -then - echo "\033[0;33mYou already have Oh My Zsh installed.\033[0m You'll need to remove ~/.oh-my-zsh if you want to install" - exit -fi - -echo "\033[0;34mCloning Oh My Zsh...\033[0m" -hash git >/dev/null && /usr/bin/env git clone git@github.com:nathanstilwell/oh-my-zsh.git ~/.oh-my-zsh || { - echo "git not installed" - exit -} - -echo "\033[0;34mLooking for an existing zsh config...\033[0m" -if [ -f ~/.zshrc ] || [ -h ~/.zshrc ] -then - echo "\033[0;33mFound ~/.zshrc.\033[0m \033[0;32mBacking up to ~/.zshrc.pre-oh-my-zsh\033[0m"; - mv ~/.zshrc ~/.zshrc.pre-oh-my-zsh; -fi - -echo "\033[0;34mTime to change your default shell to zsh!\033[0m" -chsh -s `which zsh` - -echo "\033[0;32m"' __ __ '"\033[0m" -echo "\033[0;32m"' ____ / /_ ____ ___ __ __ ____ _____/ /_ '"\033[0m" -echo "\033[0;32m"' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '"\033[0m" -echo "\033[0;32m"'/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '"\033[0m" -echo "\033[0;32m"'\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '"\033[0m" -echo "\033[0;32m"' /____/ '"\033[0m" - -echo "\n\n \033[0;32m....is now installed.\033[0m" -/usr/bin/env zsh -source ~/.zshrc diff --git a/tools/require_tool.sh b/tools/require_tool.sh deleted file mode 100755 index 1fa77f77a..000000000 --- a/tools/require_tool.sh +++ /dev/null @@ -1,161 +0,0 @@ -__require_tool_version_compare () -{ - ( - # Locally ignore failures, otherwise we'll exit whenever $1 and $2 - # are not equal! - set +e - -awk_strverscmp=' - # Use only awk features that work with 7th edition Unix awk (1978). - # My, what an old awk you have, Mr. Solaris! - END { - while (length(v1) || length(v2)) { - # Set d1 to be the next thing to compare from v1, and likewise for d2. - # Normally this is a single character, but if v1 and v2 contain digits, - # compare them as integers and fractions as strverscmp does. - if (v1 ~ /^[0-9]/ && v2 ~ /^[0-9]/) { - # Split v1 and v2 into their leading digit string components d1 and d2, - # and advance v1 and v2 past the leading digit strings. - for (len1 = 1; substr(v1, len1 + 1) ~ /^[0-9]/; len1++) continue - for (len2 = 1; substr(v2, len2 + 1) ~ /^[0-9]/; len2++) continue - d1 = substr(v1, 1, len1); v1 = substr(v1, len1 + 1) - d2 = substr(v2, 1, len2); v2 = substr(v2, len2 + 1) - if (d1 ~ /^0/) { - if (d2 ~ /^0/) { - # Compare two fractions. - while (d1 ~ /^0/ && d2 ~ /^0/) { - d1 = substr(d1, 2); len1-- - d2 = substr(d2, 2); len2-- - } - if (len1 != len2 && ! (len1 && len2 && substr(d1, 1, 1) == substr(d2, 1, 1))) { - # The two components differ in length, and the common prefix - # contains only leading zeros. Consider the longer to be less. - d1 = -len1 - d2 = -len2 - } else { - # Otherwise, compare as strings. - d1 = "x" d1 - d2 = "x" d2 - } - } else { - # A fraction is less than an integer. - exit 1 - } - } else { - if (d2 ~ /^0/) { - # An integer is greater than a fraction. - exit 2 - } else { - # Compare two integers. - d1 += 0 - d2 += 0 - } - } - } else { - # The normal case, without worrying about digits. - if (v1 == "") d1 = v1; else { d1 = substr(v1, 1, 1); v1 = substr(v1,2) } - if (v2 == "") d2 = v2; else { d2 = substr(v2, 1, 1); v2 = substr(v2,2) } - } - if (d1 < d2) exit 1 - if (d1 > d2) exit 2 - } - } -' - awk "$awk_strverscmp" v1="$1" v2="$2" /dev/null - case $? in - 1) echo '<';; - 0) echo '=';; - 2) echo '>';; - esac - ) -} - - -__require_tool_fatal () -{ - echo $@ >/dev/stderr - return 1 -} - -# Usage: require_tool program version -# Returns: 0 if $1 version if greater equals than $2, 1 otherwise. -# In case of error, message is written on error output. -# -# Example: require_tool gcc 4.6 -# Use GCC environment variable if defined instead of lookup for the tool -# in the environment. -require_tool () -{ - envvar_name=$(echo $1 | tr '[:lower:]' '[:upper:]') - tool=$(printenv $envvar_name || echo $1) - local version=$($tool --version 2>/dev/null| \ - sed -n 's/.*[^0-9.]\([0-9]*\.[0-9.]*\).*/\1/p;q') - if test x"$version" = x ; then - echo "$tool is required" >/dev/stderr - return 1 - fi - case $(__require_tool_version_compare "$2" "$version") in - '>') - echo "$1 $2 or better is required: this is $tool $version" >/dev/stderr - return 1 - ;; - esac -} - -usage() { - cat < /dev/null ; then - echo "Already in favlist" - else - echo $THEME_NAME >> $FAVLIST - echo "Saved to favlist" - fi - -} - -function theme_chooser() { - for THEME in $(ls $THEMES_DIR); do - echo - theme_preview $THEME - echo - if [[ -z $1 ]]; then - noyes "Do you want to add it to your favourite list ($FAVLIST)?" || \ - insert_favlist $THEME_NAME - echo - fi - done -} - -while getopts ":lhs" Option -do - case $Option in - l ) list_themes ;; - s ) theme_chooser 0 ;; - h ) usage ;; - * ) usage ;; # Default. - esac -done - -if [[ -z $Option ]]; then - if [[ -z $1 ]]; then - banner - echo - theme_chooser - else - theme_preview $1".zsh-theme" - fi -fi diff --git a/tools/uninstall.sh b/tools/uninstall.sh deleted file mode 100644 index 41d601576..000000000 --- a/tools/uninstall.sh +++ /dev/null @@ -1,28 +0,0 @@ -echo "Removing ~/.oh-my-zsh" -if [[ -d ~/.oh-my-zsh ]] -then - rm -rf ~/.oh-my-zsh -fi - -echo "Looking for original zsh config..." -if [ -f ~/.zshrc.pre-oh-my-zsh ] || [ -h ~/.zshrc.pre-oh-my-zsh ] -then - echo "Found ~/.zshrc.pre-oh-my-zsh -- Restoring to ~/.zshrc"; - - if [ -f ~/.zshrc ] || [ -h ~/.zshrc ] - then - ZSHRC_SAVE=".zshrc.omz-uninstalled-`date +%Y%m%d%H%M%S`"; - echo "Found ~/.zshrc -- Renaming to ~/${ZSHRC_SAVE}"; - mv ~/.zshrc ~/${ZSHRC_SAVE}; - fi - - mv ~/.zshrc.pre-oh-my-zsh ~/.zshrc; - - source ~/.zshrc; -else - echo "Switching back to bash" - chsh -s /bin/bash - source /etc/profile -fi - -echo "Thanks for trying out Oh My Zsh. It's been uninstalled." diff --git a/tools/upgrade.sh b/tools/upgrade.sh deleted file mode 100644 index e04fc672f..000000000 --- a/tools/upgrade.sh +++ /dev/null @@ -1,16 +0,0 @@ -printf '\033[0;34m%s\033[0m\n' "Upgrading Oh My Zsh" -cd "$ZSH" -if git pull --rebase origin master -then - printf '\033[0;32m%s\033[0m\n' ' __ __ ' - printf '\033[0;32m%s\033[0m\n' ' ____ / /_ ____ ___ __ __ ____ _____/ /_ ' - printf '\033[0;32m%s\033[0m\n' ' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ ' - printf '\033[0;32m%s\033[0m\n' '/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / ' - printf '\033[0;32m%s\033[0m\n' '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ ' - printf '\033[0;32m%s\033[0m\n' ' /____/ ' - printf '\033[0;34m%s\033[0m\n' 'Hooray! Oh My Zsh has been updated and/or is at the current version.' - printf '\033[0;34m%s\033[1m%s\033[0m\n' 'To keep up on the latest, be sure to follow Oh My Zsh on twitter: ' 'http://twitter.com/ohmyzsh' -else - printf '\033[0;31m%s\033[0m\n' 'There was an error updating. Try again later?' -fi -