Pārlūkot izejas kodu

Merge pull request #264 from ialokim/uninstaller

Add an uninstall.sh
pull/266/head
Nikolai Aleksandrovich Pavlov pirms 6 gadiem
revīziju iesūtīja GitHub
vecāks
revīzija
d983af487e
Šim parakstam datu bāzē netika atrasta zināma atslēga GPG atslēgas ID: 4AEE18F83AFDEB23
3 mainītis faili ar 45 papildinājumiem un 7 dzēšanām
  1. +9
    -0
      README.rst
  2. +5
    -7
      install.sh
  3. +31
    -0
      uninstall.sh

+ 9
- 0
README.rst Parādīt failu

@ -30,6 +30,15 @@ On other environments, you can copy and paste these commands to your terminal. C
cd ..
rm -rf fonts
Uninstall
---------
Run ``./uninstall.sh`` to uninstall all Powerline Fonts. You can also copy
the quick installation commands changing only the line ``./install.sh`` to
``./uninstall.sh``.
In both cases, please make sure you are working with the exact same version
of Powerline fonts you had checked out while installing.
Font Families
-------------

+ 5
- 7
install.sh Parādīt failu

@ -1,14 +1,12 @@
#!/bin/bash
# Set source and target directories
powerline_fonts_dir=$( cd "$( dirname "$0" )" && pwd )
powerline_fonts_dir="$( cd "$( dirname "$0" )" && pwd )"
# if an argument is given it is used to select which fonts to install
prefix="$1"
find_command="find \"$powerline_fonts_dir\" \( -name '$prefix*.[o,t]tf' -or -name '$prefix*.pcf.gz' \) -type f -print0"
if [[ `uname` == 'Darwin' ]]; then
if test "$(uname)" = "Darwin" ; then
# MacOS
font_dir="$HOME/Library/Fonts"
else
@ -19,12 +17,12 @@ fi
# Copy all fonts to user fonts directory
echo "Copying fonts..."
eval $find_command | xargs -0 -n1 -I % cp "%" "$font_dir/"
find "$powerline_fonts_dir" \( -name "$prefix*.[ot]tf" -or -name "$prefix*.pcf.gz" \) -type f -print0 | xargs -0 -n1 -I % cp "%" "$font_dir/"
# Reset font cache on Linux
if command -v fc-cache @>/dev/null ; then
if which fc-cache >/dev/null 2>&1 ; then
echo "Resetting font cache, this may take a moment..."
fc-cache -f $font_dir
fc-cache -f "$font_dir"
fi
echo "Powerline fonts installed to $font_dir"

+ 31
- 0
uninstall.sh Parādīt failu

@ -0,0 +1,31 @@
#!/bin/bash
# Set source and target directories
powerline_fonts_dir="$( cd "$( dirname "$0" )" && pwd )"
# if an argument is given it is used to select which fonts to uninstall
prefix="$1"
if test "$(uname)" = "Darwin" ; then
# MacOS
font_dir="$HOME/Library/Fonts"
else
# Linux
font_dir="$HOME/.local/share/fonts"
if test ! -d "$font_dir" ; then
echo "It seems there are no powerline fonts installed on your system. Uninstall not needed."
exit 0
fi
fi
# Remove all fonts from user fonts directory
echo "Removing fonts..."
find "$powerline_fonts_dir" \( -name "$prefix*.[ot]tf" -or -name "$prefix*.pcf.gz" \) -type f -print0 | xargs -n1 -0 -I % sh -c "rm -f \"\$0/\${1##*/}\"" "$font_dir" %
# Reset font cache on Linux
if which fc-cache >/dev/null 2>&1 ; then
echo "Resetting font cache, this may take a moment..."
fc-cache -f "$font_dir"
fi
echo "Powerline fonts uninstalled from $font_dir"

Notiek ielāde…
Atcelt
Saglabāt