mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-26 02:12:33 +01:00
Git didn't run everything I expected. now it should have..
This commit is contained in:
parent
fad4edbf2e
commit
f6fb5366ff
8 changed files with 0 additions and 361 deletions
0
dummy
0
dummy
|
|
@ -1 +0,0 @@
|
||||||
This directory is worthless to our fork, Remove?
|
|
||||||
|
|
@ -1,35 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
function _current_epoch() {
|
|
||||||
echo $(($(date +%s) / 60 / 60 / 24))
|
|
||||||
}
|
|
||||||
|
|
||||||
function _update_zsh_update() {
|
|
||||||
echo "LAST_EPOCH=$(_current_epoch)" > ~/.zsh-update
|
|
||||||
}
|
|
||||||
|
|
||||||
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 6 ]
|
|
||||||
then
|
|
||||||
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
|
|
||||||
/usr/bin/env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh
|
|
||||||
# update the zsh file
|
|
||||||
_update_zsh_update
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# create the zsh file
|
|
||||||
_update_zsh_update
|
|
||||||
fi
|
|
||||||
|
|
@ -1,36 +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"
|
|
||||||
/usr/bin/env git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
|
|
||||||
|
|
||||||
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;32]Backing up to ~/.zshrc.pre-oh-my-zsh\033[0m";
|
|
||||||
cp ~/.zshrc ~/.zshrc.pre-oh-my-zsh;
|
|
||||||
rm ~/.zshrc;
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "\033[0;34mUsing the Oh My Zsh template file and adding it to ~/.zshrc\033[0m"
|
|
||||||
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
|
|
||||||
|
|
||||||
echo "\033[0;34mCopying your current PATH and adding it to the end of ~/.zshrc for you.\033[0m"
|
|
||||||
echo "export PATH=$PATH" >> ~/.zshrc
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
@ -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 <<EOF
|
|
||||||
NAME
|
|
||||||
require_tool.sh - Ensure version of a tool is greater than the one expected
|
|
||||||
|
|
||||||
SYNOPSYS
|
|
||||||
require_tool.sh [ -h ]
|
|
||||||
[ --help ]
|
|
||||||
[ TOOL MIN_VERSION ]
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
TOOL is the name or path of the program to check. If the name is specified, its
|
|
||||||
path is deduced from PATH environment variable. If environment variable TOOL
|
|
||||||
(in upper-case characters) is defined, considers its value as path to the tool.
|
|
||||||
|
|
||||||
MIN_VERSION is a string representing the minimum required version.
|
|
||||||
|
|
||||||
BEHAVIOR
|
|
||||||
* locate path to the program.
|
|
||||||
* execute $ TOOL_PATH --version
|
|
||||||
* extract version from standard output.
|
|
||||||
* compare this version to the expected one.
|
|
||||||
|
|
||||||
OPTIONS
|
|
||||||
-h --help
|
|
||||||
Display this message and exit 0
|
|
||||||
|
|
||||||
ERRORS
|
|
||||||
if program is not found or its version is prior to expected version,
|
|
||||||
a message is written to error output.
|
|
||||||
|
|
||||||
EXIT VALUE
|
|
||||||
returns 0 if program version if greater equals than expected version,
|
|
||||||
returns 1 otherwise.
|
|
||||||
|
|
||||||
EXAMPLE
|
|
||||||
$ require_tool.sh emacs 23
|
|
||||||
$ CC=g++ require_tool.sh cc 4.6
|
|
||||||
$ require_tool.sh zsh 4.5
|
|
||||||
|
|
||||||
EOF
|
|
||||||
}
|
|
||||||
|
|
||||||
for arg in $@; do
|
|
||||||
case $arg in
|
|
||||||
-h|--help)
|
|
||||||
usage
|
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
if [ $# -gt 2 ] ; then
|
|
||||||
echo "ERROR: expecting 2 parameters. Please see option --help"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
require_tool $@
|
|
||||||
|
|
@ -1,96 +0,0 @@
|
||||||
#!/bin/zsh
|
|
||||||
|
|
||||||
# Zsh Theme Chooser by fox (fox91 at anche dot no)
|
|
||||||
# This program is free software. It comes without any warranty, to
|
|
||||||
# the extent permitted by applicable law. You can redistribute it
|
|
||||||
# and/or modify it under the terms of the Do What The Fuck You Want
|
|
||||||
# To Public License, Version 2, as published by Sam Hocevar. See
|
|
||||||
# http://sam.zoy.org/wtfpl/COPYING for more details.
|
|
||||||
|
|
||||||
THEMES_DIR="$ZSH/themes"
|
|
||||||
FAVLIST="${HOME}/.zsh_favlist"
|
|
||||||
source $ZSH/oh-my-zsh.zsh
|
|
||||||
|
|
||||||
function noyes() {
|
|
||||||
read "a?$1 [y/N] "
|
|
||||||
if [[ $a == "N" || $a == "n" || $a = "" ]]; then
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
function theme_preview() {
|
|
||||||
THEME=$1
|
|
||||||
THEME_NAME=`echo $THEME | sed s/\.zsh-theme$//`
|
|
||||||
print "$fg[blue]${(l.((${COLUMNS}-${#THEME_NAME}-5))..─.)}$reset_color $THEME_NAME $fg[blue]───$reset_color"
|
|
||||||
source "$THEMES_DIR/$THEME"
|
|
||||||
print -P $PROMPT
|
|
||||||
}
|
|
||||||
|
|
||||||
function banner() {
|
|
||||||
echo
|
|
||||||
echo "[0;1;35;95m╺━[0;1;31;91m┓┏[0;1;33;93m━┓[0;1;32;92m╻[0m [0;1;36;96m╻[0m [0;1;35;95m╺┳[0;1;31;91m╸╻[0m [0;1;33;93m╻[0;1;32;92m┏━[0;1;36;96m╸┏[0;1;34;94m┳┓[0;1;35;95m┏━[0;1;31;91m╸[0m [0;1;32;92m┏━[0;1;36;96m╸╻[0m [0;1;34;94m╻[0;1;35;95m┏━[0;1;31;91m┓┏[0;1;33;93m━┓[0;1;32;92m┏━[0;1;36;96m┓┏[0;1;34;94m━╸[0;1;35;95m┏━[0;1;31;91m┓[0m"
|
|
||||||
echo "[0;1;31;91m┏━[0;1;33;93m┛┗[0;1;32;92m━┓[0;1;36;96m┣━[0;1;34;94m┫[0m [0;1;31;91m┃[0m [0;1;33;93m┣[0;1;32;92m━┫[0;1;36;96m┣╸[0m [0;1;34;94m┃[0;1;35;95m┃┃[0;1;31;91m┣╸[0m [0;1;36;96m┃[0m [0;1;34;94m┣[0;1;35;95m━┫[0;1;31;91m┃[0m [0;1;33;93m┃┃[0m [0;1;32;92m┃[0;1;36;96m┗━[0;1;34;94m┓┣[0;1;35;95m╸[0m [0;1;31;91m┣┳[0;1;33;93m┛[0m"
|
|
||||||
echo "[0;1;33;93m┗━[0;1;32;92m╸┗[0;1;36;96m━┛[0;1;34;94m╹[0m [0;1;35;95m╹[0m [0;1;33;93m╹[0m [0;1;32;92m╹[0m [0;1;36;96m╹[0;1;34;94m┗━[0;1;35;95m╸╹[0m [0;1;31;91m╹[0;1;33;93m┗━[0;1;32;92m╸[0m [0;1;34;94m┗━[0;1;35;95m╸╹[0m [0;1;31;91m╹[0;1;33;93m┗━[0;1;32;92m┛┗[0;1;36;96m━┛[0;1;34;94m┗━[0;1;35;95m┛┗[0;1;31;91m━╸[0;1;33;93m╹┗[0;1;32;92m╸[0m"
|
|
||||||
echo
|
|
||||||
}
|
|
||||||
|
|
||||||
function usage() {
|
|
||||||
echo "Usage: $0 [options] [theme]"
|
|
||||||
echo
|
|
||||||
echo "Options"
|
|
||||||
echo " -l List available themes"
|
|
||||||
echo " -s Show all themes"
|
|
||||||
echo " -h Get this help message"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
function list_themes() {
|
|
||||||
for THEME in $(ls $THEMES_DIR); do
|
|
||||||
THEME_NAME=`echo $THEME | sed s/\.zsh-theme$//`
|
|
||||||
echo $THEME_NAME
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
function insert_favlist() {
|
|
||||||
if grep -q "$THEME_NAME" $FAVLIST 2> /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
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
echo "Removing ~/.oh-my-zsh"
|
|
||||||
if [[ -d ~/.oh-my-zsh ]]
|
|
||||||
then
|
|
||||||
rm -rf ~/.oh-my-zsh
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Looking for an existing zsh config..."
|
|
||||||
if [ -f ~/.zshrc.pre-oh-my-zsh ] || [ -h ~/.zshrc.pre-oh-my-zsh ]
|
|
||||||
then
|
|
||||||
echo "Found ~/.zshrc. Backing up to ~/.zshrc.pre-oh-my-zsh";
|
|
||||||
rm ~/.zshrc;
|
|
||||||
cp ~/.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."
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
current_path=`pwd`
|
|
||||||
echo -e "\033[0;34mUpgrading Oh My Zsh\033[0m"
|
|
||||||
( cd $ZSH && git pull origin master )
|
|
||||||
echo -e "\033[0;32m"' __ __ '"\033[0m"
|
|
||||||
echo -e "\033[0;32m"' ____ / /_ ____ ___ __ __ ____ _____/ /_ '"\033[0m"
|
|
||||||
echo -e "\033[0;32m"' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '"\033[0m"
|
|
||||||
echo -e "\033[0;32m"'/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '"\033[0m"
|
|
||||||
echo -e "\033[0;32m"'\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '"\033[0m"
|
|
||||||
echo -e "\033[0;32m"' /____/ '"\033[0m"
|
|
||||||
echo -e "\033[0;34mHooray! Oh My Zsh has been updated and/or is at the current version.\033[0m"
|
|
||||||
echo -e "\033[0;34mTo keep up on the latest, be sure to follow Oh My Zsh on twitter: \033[1mhttp://twitter.com/ohmyzsh\033[0m"
|
|
||||||
cd "$current_path"
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue