improve selfupdate, add documentation

whole-command-tab-completion
bretello 2020-02-14 16:37:44 +01:00
parent 0663467577
commit 6680bb4828
3 changed files with 9 additions and 15 deletions

View File

@ -17,6 +17,11 @@ Copy the dotfiles folder to the location where you want to keep it and then run
Installs oh-my-zsh and sources aliases.sh, functions.sh and colors.sh, as well as installing
a a few utilities (see `install.sh`).
A self-update mechanism is included. It asks for confirmation to pull the latest changes
from the git repo every two weeks. This also updates the git-sourced repositories installed
by the install script. The self-update routine can be called manually by calling
`dotfiles_selfupdate` (defined in `functions.sh`).
### Installed ###
0. oh-my-zsh (zsh config framework, lots of plugins available at https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins)

View File

@ -15,12 +15,12 @@ function _update_dotfiles_update() {
}
function _upgrade_dotfiles() {
(cd $DOTFILES; git pull --rebase &>/dev/null && echo "Succesfully upgraded dotfiles" || echo "Could not upgrade dotfiles")
(cd $DOTFILES; git pull -q --rebase && echo "Succesfully upgraded dotfiles" || echo "Could not upgrade dotfiles.")
# amix's vimrc update
amix_vimrc=$HOME/.vim_runtime
if [[ -d $amix_vimrc ]]; then
# the update_plugins.py script makes the vim_runtime dir dirty, so we have to reset --hard
(cd $amix_vimrc && git reset --hard HEAD >/dev/null && git pull --rebase >/dev/null && echo "Upgraded amix's vimrc" || echo "Could not upgrade amix's vimrc" >&2)
(cd $amix_vimrc && git reset --hard HEAD >/dev/null && git pull -q --rebase && echo "Upgraded amix's vimrc" || echo "Could not upgrade amix's vimrc" >&2)
(python $amix_vimrc/update_plugins.py >/dev/null || echo "upgraded amix's vimrc's plugins || "echo "Could not upgrade amix's vimrc's plugins" >&2)
else
echo "Could not upgrade amix's vimrc and plugins (missing .vim_runtime folder)" >&2
@ -29,7 +29,7 @@ function _upgrade_dotfiles() {
# custom zsh plugins
custom_plugins=("alias-tips" "fast-syntax-highlighting" "zsh-autosuggestions")
for plugin in $custom_plugins; do
(cd $ZSH/custom/plugins/$plugin && git pull --rebase >/dev/null && echo "Upgraded oh-my-zsh plugin: $plugin" || echo "Could not upgrade oh-my-zsh plugin: $plugin" >&2)
(cd $ZSH/custom/plugins/$plugin && git pull -q --rebase && echo "Upgraded oh-my-zsh plugin: $plugin" || echo "Could not upgrade oh-my-zsh plugin: $plugin" >&2)
done
# update the zsh file

View File

@ -4,18 +4,7 @@
## Selfupdate
function dotfiles_selfupdate
{
# Pull dotfiles
(cd $DOTFILES; git pull --rebase)
WD=$PWD
# Update all git repos in $ZSH/custom/plugins
cd "$ZSH/custom/plugins"
for folder in *; do
if [[ -f "$folder/.git" ]]; then
(cd $folder; git pull)
fi
done
# go back to previous working directory
cd "$WD"
(. $DOTFILES/check_for_update.sh && _upgrade_dotfiles)
}
## get cheat sheets for commands from cheat.sh. Usage: cheat commandname