2022-06-18 14:13:08 -04:00
|
|
|
if [[ -n "$(which-command chezmoi)" ]]; then
|
2022-09-26 18:39:41 -04:00
|
|
|
export CHEZMOIROOT="$(chezmoi source-path)"
|
2022-09-27 06:32:00 -04:00
|
|
|
export CZ="$CHEZMOIROOT"
|
|
|
|
export CZ_X="$(readlink -f $CHEZMOIROOT/../_externals)"
|
2022-08-11 09:18:21 -04:00
|
|
|
|
2022-09-26 12:08:18 -04:00
|
|
|
alias czcd="cd $CZ"
|
|
|
|
alias czxcd="cd $CZ_X"
|
2022-06-07 00:42:50 -04:00
|
|
|
|
2022-05-29 00:17:40 +00:00
|
|
|
alias cz="chezmoi "
|
2022-09-26 18:39:41 -04:00
|
|
|
alias czx="chezmoi --source $CZ_X --config $HOME/.config/chezmoi/chezmoi.externals.toml "
|
2022-06-07 00:42:50 -04:00
|
|
|
|
2022-09-26 12:08:18 -04:00
|
|
|
alias czs="cz status "
|
|
|
|
|
|
|
|
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"
|
|
|
|
alias cz-commit="cz git -- commit -a "
|
2022-05-29 00:17:40 +00:00
|
|
|
|
2022-09-26 12:08:18 -04:00
|
|
|
function cz() {
|
|
|
|
chezmoi "${@}"
|
|
|
|
}
|
2022-06-06 10:28:09 -04:00
|
|
|
function cz-remove-missing() {
|
|
|
|
pushd ~ > /dev/null
|
2022-09-26 12:08:18 -04:00
|
|
|
changes=$(cz status | sed -n 's/^DA[ \t]\+//p')
|
2022-06-06 10:28:09 -04:00
|
|
|
for c in $changes; do
|
2022-09-26 12:08:18 -04:00
|
|
|
cz rm $c
|
2022-06-06 10:28:09 -04:00
|
|
|
done
|
|
|
|
popd > /dev/null
|
|
|
|
}
|
|
|
|
|
2022-06-04 15:31:20 -04:00
|
|
|
function cz-add-changes() {
|
|
|
|
pushd ~ > /dev/null
|
2022-09-26 12:08:18 -04:00
|
|
|
changes=$(cz status | sed -n 's/^MM[ \t]\+//p')
|
2022-06-04 15:31:20 -04:00
|
|
|
for c in $changes; do
|
|
|
|
echo Adding $c
|
2022-09-26 12:08:18 -04:00
|
|
|
cz add $c
|
2022-06-04 15:31:20 -04:00
|
|
|
done
|
|
|
|
popd > /dev/null
|
|
|
|
}
|
|
|
|
|
2022-05-29 00:17:40 +00:00
|
|
|
function cz-set-ssh-github() {
|
2022-09-26 12:08:18 -04:00
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
function cz-set-https-github() {
|
2022-09-26 12:08:18 -04:00
|
|
|
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
|