2022-06-18 18:13:08 +00:00
|
|
|
if [[ -n "$(which-command chezmoi)" ]]; then
|
2022-09-29 22:29:13 +00:00
|
|
|
export CHEZMOIROOT="$(chezmoi source-path)"
|
|
|
|
export CZ="$CHEZMOIROOT"
|
|
|
|
export CZ_X="$(readlink -f $CHEZMOIROOT/../_externals)"
|
2022-08-11 13:18:21 +00:00
|
|
|
|
2022-09-29 22:29:13 +00:00
|
|
|
alias czcd="cd $CZ"
|
|
|
|
alias czxcd="cd $CZ_X"
|
|
|
|
|
|
|
|
function cz() { chezmoi "${@}"; }
|
|
|
|
function czx() {
|
|
|
|
chezmoi --source $CZ_X --config $HOME/.config/chezmoi.externals/config.toml "${@}"
|
|
|
|
}
|
2022-06-07 04:42:50 +00:00
|
|
|
|
2022-09-29 22:29:13 +00:00
|
|
|
alias czs="cz status "
|
|
|
|
function czg() {
|
|
|
|
cz git -- "${@}"
|
|
|
|
}
|
|
|
|
#alias czg="cz git -- "
|
|
|
|
alias czgs="cz git -- status "
|
|
|
|
alias cza="cz apply && exec $SHELL"
|
|
|
|
alias czu="cz upgrade && cz update && exec $SHELL "
|
|
|
|
alias czxu="cz upgrade && cz update && czx apply && exec $SHELL "
|
|
|
|
|
2022-10-06 02:29:21 +00:00
|
|
|
alias cz-refresh="czs | cut -d\ -f2 | grep '^\.sz\.shrc\.d' | xargs cz forget --force; cz add ~/.sz.shrc.d --recursive; cz status; cz git status"
|
2022-09-29 22:29:13 +00:00
|
|
|
alias cz-commit="cz git -- commit -a "
|
2022-05-29 00:17:40 +00:00
|
|
|
|
2022-09-29 22:29:13 +00:00
|
|
|
function cz-remove-missing() {
|
|
|
|
pushd ~ > /dev/null
|
|
|
|
changes=$(cz status | sed -n 's/^DA[ \t]\+//p')
|
|
|
|
for c in $changes; do
|
|
|
|
cz rm $c
|
|
|
|
done
|
|
|
|
popd > /dev/null
|
|
|
|
}
|
2022-06-06 14:28:09 +00:00
|
|
|
|
2022-09-29 22:29:13 +00:00
|
|
|
function cz-add-changes() {
|
|
|
|
pushd ~ > /dev/null
|
|
|
|
changes=$(cz status | sed -n 's/^MM[ \t]\+//p')
|
|
|
|
for c in $changes; do
|
|
|
|
echo Adding $c
|
|
|
|
cz add $c
|
|
|
|
done
|
|
|
|
popd > /dev/null
|
|
|
|
}
|
2022-06-04 19:31:20 +00:00
|
|
|
|
2022-09-29 22:29:13 +00:00
|
|
|
function cz-set-ssh-github() {
|
|
|
|
cz git -- remote set-url origin "$( \
|
|
|
|
cz git -- remote get-url origin \
|
|
|
|
| sed 's|https://github.com/|git@github.com:|' \
|
|
|
|
)"
|
|
|
|
cz git -- remote get-url origin
|
|
|
|
}
|
2022-05-29 00:17:40 +00:00
|
|
|
|
2022-09-29 22:29:13 +00:00
|
|
|
function cz-set-https-github() {
|
|
|
|
cz git -- remote set-url origin "$( \
|
|
|
|
cz git -- remote get-url origin \
|
|
|
|
| sed 's|git@github.com:|https://github.com/|' \
|
|
|
|
)"
|
|
|
|
cz git -- remote get-url origin
|
|
|
|
}
|
2022-05-29 00:17:40 +00:00
|
|
|
fi
|