Moved externals to separate chezmoi repo

Following discussion on
This commit is contained in:
Gal Szkolnik 2022-09-26 12:08:18 -04:00
parent f38f61cc6d
commit fed4970b64
2 changed files with 21 additions and 97 deletions

View file

@ -1,43 +1,48 @@
if [[ -n "$(which-command chezmoi)" ]]; then
export CZ="$(chezmoi source-path)"
export CZ_X="$CZ.externals"
export CHEZMOIROOT="$CZ"
alias cdcz="cd $CZ"
alias czcd="cdcz "
alias czcd="cd $CZ"
alias czxcd="cd $CZ_X"
alias cz="chezmoi "
alias czx="chezmoi --source $CZ_X --config $HOME/.config/chezmoi.externals/chezmoi.toml "
alias czs="chezmoi status "
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 "
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 "
function cz() {
chezmoi "${@}"
}
function cz-remove-missing() {
pushd ~ > /dev/null
changes=$(chezmoi status | sed -n 's/^DA[ \t]\+//p')
changes=$(cz status | sed -n 's/^DA[ \t]\+//p')
for c in $changes; do
chezmoi rm $c
cz rm $c
done
popd > /dev/null
}
function cz-add-changes() {
pushd ~ > /dev/null
changes=$(chezmoi status | sed -n 's/^MM[ \t]\+//p')
changes=$(cz status | sed -n 's/^MM[ \t]\+//p')
for c in $changes; do
echo Adding $c
chezmoi add $c
cz add $c
done
popd > /dev/null
}
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
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
}
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
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
}
fi