Unverified Commit 0232ac4b authored by Marc Cornellà's avatar Marc Cornellà Committed by GitHub
Browse files

Merge branch 'master' into master

parents afb02876 ebc700be
# user, host, full path, and time/date # user, host, full path, and time/date
# on two lines for easier vgrepping # on two lines for easier vgrepping
# entry in a nice long thread on the Arch Linux forums: http://bbs.archlinux.org/viewtopic.php?pid=521888#p521888 # entry in a nice long thread on the Arch Linux forums: https://bbs.archlinux.org/viewtopic.php?pid=521888#p521888
PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%a %b %d, %H:%M"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%a %b %d, %H:%M"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%}
%{\e[0;34m%}%B└─%B[%{\e[1;35m%}$%{\e[0;34m%}%B] <$(git_prompt_info)>%{\e[0m%}%b ' %{\e[0;34m%}%B└─%B[%{\e[1;35m%}$%{\e[0;34m%}%B] <$(git_prompt_info)>%{\e[0m%}%b '
PS2=$' \e[0;34m%}%B>%{\e[0m%}%b ' PS2=$' \e[0;34m%}%B>%{\e[0m%}%b '
# user, host, full path, and time/date # user, host, full path, and time/date
# on two lines for easier vgrepping # on two lines for easier vgrepping
# entry in a nice long thread on the Arch Linux forums: http://bbs.archlinux.org/viewtopic.php?pid=521888#p521888 # entry in a nice long thread on the Arch Linux forums: https://bbs.archlinux.org/viewtopic.php?pid=521888#p521888
PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%a %b %d, %H:%M"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%a %b %d, %H:%M"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%}
%{\e[0;34m%}%B└─%B[%{\e[1;35m%}$%{\e[0;34m%}%B]>%{\e[0m%}%b ' %{\e[0;34m%}%B└─%B[%{\e[1;35m%}$%{\e[0;34m%}%B]>%{\e[0m%}%b '
PS2=$' \e[0;34m%}%B>%{\e[0m%}%b ' PS2=$' \e[0;34m%}%B>%{\e[0m%}%b '
...@@ -7,7 +7,7 @@ function _current_epoch() { ...@@ -7,7 +7,7 @@ function _current_epoch() {
} }
function _update_zsh_update() { function _update_zsh_update() {
echo "LAST_EPOCH=$(_current_epoch)" >! ~/.zsh-update echo "LAST_EPOCH=$(_current_epoch)" >! ${ZSH_CACHE_DIR}/.zsh-update
} }
function _upgrade_zsh() { function _upgrade_zsh() {
...@@ -30,11 +30,13 @@ fi ...@@ -30,11 +30,13 @@ fi
whence git >/dev/null || return 0 whence git >/dev/null || return 0
if mkdir "$ZSH/log/update.lock" 2>/dev/null; then if mkdir "$ZSH/log/update.lock" 2>/dev/null; then
if [ -f ~/.zsh-update ]; then if [ -f ${ZSH_CACHE_DIR}/.zsh-update ]; then
. ~/.zsh-update . ${ZSH_CACHE_DIR}/.zsh-update
if [[ -z "$LAST_EPOCH" ]]; then if [[ -z "$LAST_EPOCH" ]]; then
_update_zsh_update && return 0; _update_zsh_update
rmdir $ZSH/log/update.lock # TODO: fix later
return 0
fi fi
epoch_diff=$(($(_current_epoch) - $LAST_EPOCH)) epoch_diff=$(($(_current_epoch) - $LAST_EPOCH))
...@@ -42,7 +44,7 @@ if mkdir "$ZSH/log/update.lock" 2>/dev/null; then ...@@ -42,7 +44,7 @@ if mkdir "$ZSH/log/update.lock" 2>/dev/null; then
if [ "$DISABLE_UPDATE_PROMPT" = "true" ]; then if [ "$DISABLE_UPDATE_PROMPT" = "true" ]; then
_upgrade_zsh _upgrade_zsh
else else
echo "[Oh My Zsh] Would you like to check for updates? [Y/n]: \c" echo "[Oh My Zsh] Would you like to update? [Y/n]: \c"
read line read line
if [[ "$line" == Y* ]] || [[ "$line" == y* ]] || [ -z "$line" ]; then if [[ "$line" == Y* ]] || [[ "$line" == y* ]] || [ -z "$line" ]; then
_upgrade_zsh _upgrade_zsh
......
...@@ -24,12 +24,10 @@ main() { ...@@ -24,12 +24,10 @@ main() {
# which may fail on systems lacking tput or terminfo # which may fail on systems lacking tput or terminfo
set -e set -e
CHECK_ZSH_INSTALLED=$(grep /zsh$ /etc/shells | wc -l) if ! command -v zsh >/dev/null 2>&1; then
if [ ! $CHECK_ZSH_INSTALLED -ge 1 ]; then
printf "${YELLOW}Zsh is not installed!${NORMAL} Please install zsh first!\n" printf "${YELLOW}Zsh is not installed!${NORMAL} Please install zsh first!\n"
exit exit
fi fi
unset CHECK_ZSH_INSTALLED
if [ ! -n "$ZSH" ]; then if [ ! -n "$ZSH" ]; then
ZSH=~/.oh-my-zsh ZSH=~/.oh-my-zsh
...@@ -49,7 +47,7 @@ main() { ...@@ -49,7 +47,7 @@ main() {
umask g-w,o-w umask g-w,o-w
printf "${BLUE}Cloning Oh My Zsh...${NORMAL}\n" printf "${BLUE}Cloning Oh My Zsh...${NORMAL}\n"
hash git >/dev/null 2>&1 || { command -v git >/dev/null 2>&1 || {
echo "Error: git is not installed" echo "Error: git is not installed"
exit 1 exit 1
} }
...@@ -61,7 +59,7 @@ main() { ...@@ -61,7 +59,7 @@ main() {
exit 1 exit 1
fi fi
fi fi
env git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git $ZSH || { env git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git "$ZSH" || {
printf "Error: git clone of oh-my-zsh repo failed\n" printf "Error: git clone of oh-my-zsh repo failed\n"
exit 1 exit 1
} }
...@@ -74,14 +72,14 @@ main() { ...@@ -74,14 +72,14 @@ main() {
fi fi
printf "${BLUE}Using the Oh My Zsh template file and adding it to ~/.zshrc${NORMAL}\n" printf "${BLUE}Using the Oh My Zsh template file and adding it to ~/.zshrc${NORMAL}\n"
cp $ZSH/templates/zshrc.zsh-template ~/.zshrc cp "$ZSH"/templates/zshrc.zsh-template ~/.zshrc
sed "/^export ZSH=/ c\\ sed "/^export ZSH=/ c\\
export ZSH=$ZSH export ZSH=\"$ZSH\"
" ~/.zshrc > ~/.zshrc-omztemp " ~/.zshrc > ~/.zshrc-omztemp
mv -f ~/.zshrc-omztemp ~/.zshrc mv -f ~/.zshrc-omztemp ~/.zshrc
# If this user's login shell is not already "zsh", attempt to switch. # If this user's login shell is not already "zsh", attempt to switch.
TEST_CURRENT_SHELL=$(expr "$SHELL" : '.*/\(.*\)') TEST_CURRENT_SHELL=$(basename "$SHELL")
if [ "$TEST_CURRENT_SHELL" != "zsh" ]; then if [ "$TEST_CURRENT_SHELL" != "zsh" ]; then
# If this platform provides a "chsh" command (not Cygwin), do it, man! # If this platform provides a "chsh" command (not Cygwin), do it, man!
if hash chsh >/dev/null 2>&1; then if hash chsh >/dev/null 2>&1; then
...@@ -105,12 +103,12 @@ main() { ...@@ -105,12 +103,12 @@ main() {
echo '' echo ''
echo 'Please look over the ~/.zshrc file to select plugins, themes, and options.' echo 'Please look over the ~/.zshrc file to select plugins, themes, and options.'
echo '' echo ''
echo 'p.s. Follow us at https://twitter.com/ohmyzsh.' echo 'p.s. Follow us at https://twitter.com/ohmyzsh'
echo '' echo ''
echo 'p.p.s. Get stickers and t-shirts at https://shop.planetargon.com.' echo 'p.p.s. Get stickers, shirts, and coffee mugs at https://shop.planetargon.com/collections/oh-my-zsh'
echo '' echo ''
printf "${NORMAL}" printf "${NORMAL}"
env zsh env zsh -l
} }
main main
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
# the extent permitted by applicable law. You can redistribute it # 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 # 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 # To Public License, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/wtfpl/COPYING for more details. # http://www.wtfpl.net/txt/copying/ for more details.
THEMES_DIR="$ZSH/themes" THEMES_DIR="$ZSH/themes"
FAVLIST="${HOME}/.zsh_favlist" FAVLIST="${HOME}/.zsh_favlist"
......
...@@ -33,7 +33,7 @@ then ...@@ -33,7 +33,7 @@ then
printf '%s\n' ' /____/ ' printf '%s\n' ' /____/ '
printf "${BLUE}%s\n" "Hooray! Oh My Zsh has been updated and/or is at the current version." printf "${BLUE}%s\n" "Hooray! Oh My Zsh has been updated and/or is at the current version."
printf "${BLUE}${BOLD}%s${NORMAL}\n" "To keep up on the latest news and updates, follow us on twitter: https://twitter.com/ohmyzsh" printf "${BLUE}${BOLD}%s${NORMAL}\n" "To keep up on the latest news and updates, follow us on twitter: https://twitter.com/ohmyzsh"
printf "${BLUE}${BOLD}%s${NORMAL}\n" "Get your Oh My Zsh swag at: https://shop.planetargon.com/" printf "${BLUE}${BOLD}%s${NORMAL}\n" "Get your Oh My Zsh swag at: https://shop.planetargon.com/collections/oh-my-zsh"
else else
printf "${RED}%s${NORMAL}\n" 'There was an error updating. Try again later?' printf "${RED}%s${NORMAL}\n" 'There was an error updating. Try again later?'
fi fi
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment