2022-06-18 18:13:08 +00:00
|
|
|
if [[ -n "$(which-command chezmoi)" ]]; then
|
2022-06-07 04:42:50 +00:00
|
|
|
alias cdcz="cd $(chezmoi source-path)"
|
|
|
|
alias czcd="cdcz "
|
|
|
|
|
2022-05-29 00:17:40 +00:00
|
|
|
alias cz="chezmoi "
|
2022-06-07 04:42:50 +00:00
|
|
|
|
|
|
|
alias czs="chezmoi status "
|
|
|
|
|
2022-05-29 00:17:40 +00:00
|
|
|
alias cz-refresh="chezmoi status | cut -d\ -f2 | grep '^\.sz\.shrc\.d' | xargs chezmoi forget --force; chezmoi add ~/.sz.shrc.d --recursive; chezmoi status; chezmoi git status"
|
|
|
|
alias cz-commit="chezmoi git -- commit -a "
|
|
|
|
|
2022-06-06 14:28:09 +00:00
|
|
|
function cz-remove-missing() {
|
|
|
|
pushd ~ > /dev/null
|
|
|
|
changes=$(chezmoi status | sed -n 's/^DA[ \t]\+//p')
|
|
|
|
for c in $changes; do
|
|
|
|
chezmoi rm $c
|
|
|
|
done
|
|
|
|
popd > /dev/null
|
|
|
|
}
|
|
|
|
|
2022-06-04 19:31:20 +00:00
|
|
|
function cz-add-changes() {
|
|
|
|
pushd ~ > /dev/null
|
|
|
|
changes=$(chezmoi status | sed -n 's/^MM[ \t]\+//p')
|
|
|
|
for c in $changes; do
|
|
|
|
echo Adding $c
|
|
|
|
chezmoi add $c
|
|
|
|
done
|
|
|
|
popd > /dev/null
|
|
|
|
}
|
|
|
|
|
2022-05-29 00:17:40 +00:00
|
|
|
function cz-set-ssh-github() {
|
|
|
|
chezmoi git -- remote set-url origin "$(chezmoi git -- remote get-url origin | sed 's|https://github.com/|git@github.com:|')"
|
|
|
|
chezmoi git -- remote get-url origin
|
|
|
|
}
|
|
|
|
|
|
|
|
function cz-set-https-github() {
|
|
|
|
chezmoi git -- remote set-url origin "$(chezmoi git -- remote get-url origin | sed 's|git@github.com:|https://github.com/|')"
|
|
|
|
chezmoi git -- remote get-url origin
|
|
|
|
}
|
|
|
|
fi
|