czu does some stuff for me now

This commit is contained in:
Lockszmith (cs-dbg@VAST) 2025-05-08 18:21:12 +00:00
parent 9ecb3f4910
commit 9ec99b9d7f
1 changed files with 30 additions and 1 deletions

View File

@ -50,7 +50,36 @@ if is_cmd 'chezmoi'; then
# externals yaml is performed.
alias czx="CZ_EXTR=1 chezmoi "
alias czu="czg pull && cz init --verbose && cz apply --verbose && _r"
function czu() {
local all=0 refresh=1 verbose='--verbose' debug='' prompts='--promptDefaults'
while [[ $# -gt 0 ]]; do
case "$1" in
'--all') all=1 ;;
'--prompt') prompts='' ;;
'--no-refresh') refresh=0 ;;
'--quiet') verbose='' ;;
'--debug') debug='--debug' ;;
esac
shift
done
if [[ $all -eq 1 ]]; then
chezmoi upgrade
fi
chezmoi git -- pull --autostash --rebase \
&& chezmoi init $prompts $verbose $debug \
&& chezmoi status $verbose $debug \
&& chezmoi apply --interactive --verbose $verbose $debug
if [[ $all -eq 1 ]]; then
CZ_EXTR=1
CZ_EZA_PREFIX=""
chezmoi status $verbose $debug \
|| (CZ_EZA_PREFIX='./' && chezmoi status $verbose $debug ) && chezmoi apply $verbose $debug
fi
[[ $refresh -ne 1 ]] || (printf "restarting shell...\n" >&2 || exec $SHELL -l)
}
alias czxu="cz upgrade && czg pull && cz init --verbose && czx apply --verbose && _r"
alias cz-reset-home="(czgcd && cd chezmoi.roots && RESET=reset SRC_DIR=_src.all ./symclone.sh _home && RESET=reset ./symclone.sh _home.macos)"
fi