diff --git a/chezmoi.roots/_home/private_dot_config/sz.env/981_chezmoi.env.tmpl b/chezmoi.roots/_home/private_dot_config/sz.env/981_chezmoi.env.tmpl index 0c0d668..9baa1b8 100644 --- a/chezmoi.roots/_home/private_dot_config/sz.env/981_chezmoi.env.tmpl +++ b/chezmoi.roots/_home/private_dot_config/sz.env/981_chezmoi.env.tmpl @@ -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