chezmoi alias cosmetic fixes / cleaner syntax
This commit is contained in:
parent
88a7aba840
commit
e4cfff9fcc
|
@ -18,20 +18,20 @@ if is_cmd 'chezmoi'; then
|
||||||
chezmoi() {
|
chezmoi() {
|
||||||
${SET_X:-:} -x
|
${SET_X:-:} -x
|
||||||
case "$1" in
|
case "$1" in
|
||||||
cd) cd "$(SET_X=':' command chezmoi source-path ${2})" ;;
|
cd) cz-cd "${2}" ;;
|
||||||
edit) ${VISUAL:-${EDITOR:-vi}} $(SET_X=':' chezmoi source-path "${@:2}") ;;
|
edit) ${VISUAL:-${EDITOR:-vi}} $(SET_X=':' chezmoi source-path "${@:2}") ;;
|
||||||
source-path) printf '%s\n' "${@:2}" | xargs -r chezmoi source-path ;;
|
# source-path) printf '%s\n' "${@:2}" | xargs -r env chezmoi source-path ;;
|
||||||
*) command chezmoi "${@}" ;;
|
*) env chezmoi "${@}" ;;
|
||||||
esac
|
esac
|
||||||
${SET_X:-:} +x
|
${SET_X:-:} +x
|
||||||
}
|
}
|
||||||
czcd() { chezmoi cd "${@}"; }
|
cz-cd() { cd "$(chezmoi source-path ${1})"; }
|
||||||
czgcd() {
|
czgcd() {
|
||||||
cd "$(chezmoi git -- rev-parse --show-toplevel)${1:+/${1}}"
|
cd "$(SET_X=':' chezmoi git -- rev-parse --show-toplevel)${1:+/${1}}"
|
||||||
}
|
}
|
||||||
czedext() {
|
czedext() {
|
||||||
local CZ_EXT="$(find $(command chezmoi source-path) -mindepth 1 -maxdepth 1 -name '.chezmoiexternal.*')"
|
local CZ_EXT="$(find $(SET_X=':' chezmoi source-path) -mindepth 1 -maxdepth 1 -name '.chezmoiexternal.*')"
|
||||||
CZ_EXT="${CZ_EXT:-$(chezmoi source-path "${@}")/.chezmoiexternal.yaml.tmpl}"
|
CZ_EXT="${CZ_EXT:-$(SET_X=':' chezmoi source-path "${@}")/.chezmoiexternal.yaml.tmpl}"
|
||||||
"${VISUAL:-${EDITOR:-vi}}" "${CZ_EXT}"
|
"${VISUAL:-${EDITOR:-vi}}" "${CZ_EXT}"
|
||||||
}
|
}
|
||||||
czed() {
|
czed() {
|
||||||
|
@ -44,8 +44,15 @@ if is_cmd 'chezmoi'; then
|
||||||
EDITLIST=("${@}")
|
EDITLIST=("${@}")
|
||||||
chezmoi edit "${EDITLIST[@]}" --apply --interactive
|
chezmoi edit "${EDITLIST[@]}" --apply --interactive
|
||||||
}
|
}
|
||||||
|
# CZ_EXTR is evaluated in .chezmoiexternal.yaml.
|
||||||
|
# By default, a very small portion of the externals are being
|
||||||
|
# evaluated, when CZ_EXTR is set to 1, full evaluation of the
|
||||||
|
# externals yaml is performed.
|
||||||
alias czx="CZ_EXTR=1 chezmoi "
|
alias czx="CZ_EXTR=1 chezmoi "
|
||||||
alias cz-reset-home="(czcd; cd ..; RESET=reset SRC_DIR=_src.all ./symclone _home; RESET=reset ./symclone.sh _home.macos)"
|
|
||||||
|
alias czu="czg pull && cz init --verbose && cz apply --verbose && _r"
|
||||||
|
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 _home && RESET=reset ./symclone.sh _home.macos)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# vim: set ft=sh sw=4 sts=4 et:
|
# vim: set ft=sh sw=4 sts=4 et:
|
||||||
|
|
Loading…
Reference in New Issue