dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit f57ad91750daa8ba4ecf90dd51fb400fc62644a9
parent 9453069fecf2769fcadb65f171ba985da2a2d8a3
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Wed, 26 Jun 2019 21:31:34 +0200

Better editor upgrade logic, use tabs for indentation

Diffstat:
M.local/bin/uu | 105+++++++++++++++++++++++++++++++++++++++++--------------------------------------
1 file changed, 54 insertions(+), 51 deletions(-)

diff --git a/.local/bin/uu b/.local/bin/uu @@ -1,49 +1,49 @@ #!/usr/bin/env zsh announce() { - echo -e "\n$(tput setaf 3)# $@$(tput sgr0)" + echo -e "\n$(tput setaf 3)# $@$(tput sgr0)" } announce "Updating package manager lists and installed packages" if [ "$(uname)" = "Linux" ]; then - if type pacman >/dev/null; then - sudo pacman -Syu --color auto - echo "Removing unneeded packages" - unused=$(pacman -Qdtq) - if [[ $(echo "$unused" | wc -l) -gt 1 ]]; then - echo "Unused packages:" - echo "$unused" - printf '%s ' 'Delete unused packages? [y/N]' - read REPLY - if [[ $REPLY =~ ^[Yy]$ ]]; then - sudo pacman -Rns $(echo $unused | tr '\n' ' ') --noconfirm - fi - fi + if type pacman >/dev/null; then + sudo pacman -Syu --color auto + echo "Removing unneeded packages" + unused=$(pacman -Qdtq) + if [[ $(echo "$unused" | wc -l) -gt 1 ]]; then + echo "Unused packages:" + echo "$unused" + printf '%s ' 'Delete unused packages? [y/N]' + read REPLY + if [[ $REPLY =~ ^[Yy]$ ]]; then + sudo pacman -Rns $(echo $unused | tr '\n' ' ') --noconfirm + fi + fi - echo "Removing old packages" - sudo pacman -Sc --color auto --noconfirm - fi - if type yay >/dev/null; then - yay -Syu --color auto - fi - if type apt-get >/dev/null; then - sudo apt-get update && \ - sudo apt-get -y upgrade && \ - sudo apt-get -y dist-upgrade && \ - sudo apt-get -y autoremove && \ - sudo apt-get clean - fi + echo "Removing old packages" + sudo pacman -Sc --color auto --noconfirm + fi + if type yay >/dev/null; then + yay -Syu --color auto + fi + if type apt-get >/dev/null; then + sudo apt-get update && \ + sudo apt-get -y upgrade && \ + sudo apt-get -y dist-upgrade && \ + sudo apt-get -y autoremove && \ + sudo apt-get clean + fi elif type brew >/dev/null; then - echo "Fetching updates..." - brew analytics off - brew update && \ - brew upgrade && \ - brew cask upgrade && \ - brew cleanup + echo "Fetching updates..." + brew analytics off + brew update && \ + brew upgrade && \ + brew cask upgrade && \ + brew cleanup else - (>&2 echo "Platform not supported") - exit 1 + (>&2 echo "Platform not supported") + exit 1 fi announce "Updating dotfiles" @@ -54,35 +54,38 @@ dotfiles pull --recurse-submodules && m_all_sl announce "Finished building dotfiles" if type conda >/dev/null; then - announce "Upgrading conda packages" - conda update --all --yes + announce "Upgrading conda packages" + conda update --all --yes fi if type julia >/dev/null; then - announce "Upgrading julia packages" - julia --color=yes -e 'import Pkg; Pkg.update()' + announce "Upgrading julia packages" + julia --color=yes -e 'import Pkg; Pkg.update()' fi if [ -d ~/code/zplug ]; then - announce "Upgrading zplug packages" - (zsh -c "source ~/.zshrc && zplug update") + announce "Upgrading zplug packages" + (zsh -c "source ~/.zshrc && zplug update") fi if [ -d ~/.zgen ]; then - announce "Upgrading zgen packages" - (zsh -c "source ~/.zshrc && zgen update && zgen save") + announce "Upgrading zgen packages" + (zsh -c "source ~/.zshrc && zgen update && zgen save") fi if [ -d ~/code/fffs ]; then - announce "Upgrading fffs packages" - [ ! -h ~/.local/bin/fffs ] && ln -s ~/code/fffs/fffs ~/.local/bin/fffs - fffs zsh update + announce "Upgrading fffs packages" + [ ! -h ~/.local/bin/fffs ] && ln -s ~/code/fffs/fffs ~/.local/bin/fffs + fffs zsh update fi -if [ -d ~/.vim/vim-plugs ]; then - announce "Upgrading $EDITOR packages" - $EDITOR +PlugUpgrade +PlugUpdate +qall +if [ -d ~/.vim/vim-plugs ] && [ "$EDITOR" = "vim" ]; then + announce "Upgrading $EDITOR packages" + case "$EDITOR" in + *vim*) + $EDITOR +PlugUpgrade +PlugUpdate +qall;; + esac fi if [ "$1" = 'all' ]; then - ssh adamsgaard.dk -t '~/.local/bin/uu' - ssh debvm -t '~/.local/bin/uu' + ssh adamsgaard.dk -t '~/.local/bin/uu' + ssh debvm -t '~/.local/bin/uu' fi