mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-26 02:12:33 +01:00
Initial support for favorite themes
This commit is contained in:
parent
3ed19c4895
commit
a3c24f6b78
2 changed files with 49 additions and 1 deletions
|
|
@ -50,3 +50,31 @@ function extract() {
|
|||
fi
|
||||
}
|
||||
|
||||
function get_current_theme() {
|
||||
echo `basename $RANDOM_THEME`
|
||||
}
|
||||
|
||||
function like_theme() {
|
||||
theme_name=`get_current_theme`
|
||||
link_name="$FAVORITE_THEMES_DIR/$theme_name"
|
||||
|
||||
if [[ ! -L $link_name ]]; then
|
||||
ln -s $RANDOM_THEME $link_name
|
||||
echo "Added $theme_name to favorites"
|
||||
else
|
||||
echo "$theme_name already a favorite!"
|
||||
fi
|
||||
}
|
||||
|
||||
function unlike_theme() {
|
||||
theme_name=`get_current_theme`
|
||||
link_name="$FAVORITE_THEMES_DIR/$theme_name"
|
||||
|
||||
if [[ -L $link_name ]]; then
|
||||
# FIXME: What happens if we remove the last theme we have?
|
||||
rm $link_name
|
||||
echo "Removed $theme_name from favorites"
|
||||
else
|
||||
echo "$theme_name isn't a favorite"
|
||||
fi
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue