mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-23 14:20:08 +00:00
Added the possibility of showing all preferred themes in .zsh_favlist file
This commit is contained in:
parent
c08b925d28
commit
28145c2239
1 changed files with 23 additions and 1 deletions
24
tools/theme_chooser.sh
Executable file → Normal file
24
tools/theme_chooser.sh
Executable file → Normal file
|
@ -29,6 +29,25 @@ function theme_preview() {
|
||||||
print -P "$PROMPT $RPROMPT"
|
print -P "$PROMPT $RPROMPT"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function fav_theme_preview() {
|
||||||
|
if [[ -s $FAVLIST ]]; then
|
||||||
|
for THEME_NAME in $(cat $FAVLIST); do
|
||||||
|
THEME="$THEME_NAME.zsh-theme"
|
||||||
|
print "$fg[blue]${(l.((${COLUMNS}-${#THEME_NAME}-5))..─.)}$reset_color $THEME_NAME $fg[blue]───$reset_color"
|
||||||
|
source "$THEMES_DIR/$THEME"
|
||||||
|
cols=$(tput cols)
|
||||||
|
(exit 1)
|
||||||
|
print -P "$PROMPT $RPROMPT"
|
||||||
|
done
|
||||||
|
else
|
||||||
|
if ! noyes "No ($FAVLIST) in the system. Do you want to preview all the available themes?"; then
|
||||||
|
theme_chooser 0
|
||||||
|
else
|
||||||
|
echo "Okay, exiting."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function banner() {
|
function banner() {
|
||||||
echo
|
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;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"
|
||||||
|
@ -43,6 +62,7 @@ function usage() {
|
||||||
echo "Options"
|
echo "Options"
|
||||||
echo " -l List available themes"
|
echo " -l List available themes"
|
||||||
echo " -s Show all themes"
|
echo " -s Show all themes"
|
||||||
|
echo " -f Show favourite themes"
|
||||||
echo " -h Get this help message"
|
echo " -h Get this help message"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
@ -77,11 +97,12 @@ function theme_chooser() {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
while getopts ":lhs" Option
|
while getopts ":lhsf" Option
|
||||||
do
|
do
|
||||||
case $Option in
|
case $Option in
|
||||||
l ) list_themes ;;
|
l ) list_themes ;;
|
||||||
s ) theme_chooser 0 ;;
|
s ) theme_chooser 0 ;;
|
||||||
|
f ) fav_theme_preview ;;
|
||||||
h ) usage ;;
|
h ) usage ;;
|
||||||
* ) usage ;; # Default.
|
* ) usage ;; # Default.
|
||||||
esac
|
esac
|
||||||
|
@ -96,3 +117,4 @@ if [[ -z $Option ]]; then
|
||||||
theme_preview $1".zsh-theme"
|
theme_preview $1".zsh-theme"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue