implement an old chezmoi cd idea of mine
This commit is contained in:
parent
80df1088bd
commit
58c86a7e81
|
@ -13,9 +13,18 @@ if is_cmd 'chezmoi'; then
|
||||||
|
|
||||||
complete -F _complete_alias czg
|
complete -F _complete_alias czg
|
||||||
|
|
||||||
czcd() {
|
chezmoi() {
|
||||||
cd "$(chezmoi source-path "${@}")"
|
${SET_X:-:} -x
|
||||||
|
local _args=()
|
||||||
|
[ $# -ge 2 ] && _args=("${@:2}")
|
||||||
|
case "$1" in
|
||||||
|
"cd") cd "$(command chezmoi source-path "${_args[@]}")" ;;
|
||||||
|
"edit") ${VISUAL:-${EDITOR:-vi}} $(command chezmoi sourch-path "${_args[@]}") ;;
|
||||||
|
*) command chezmoi "${@}" ;;
|
||||||
|
esac
|
||||||
|
${SET_X:-:} +x
|
||||||
}
|
}
|
||||||
|
czcd() { chezmoi cd "${@}"; }
|
||||||
czedext() {
|
czedext() {
|
||||||
local CZ_EXT="$(find $(chezmoi source-path) -mindepth 1 -maxdepth 1 -name '.chezmoiexternal.*')"
|
local CZ_EXT="$(find $(chezmoi source-path) -mindepth 1 -maxdepth 1 -name '.chezmoiexternal.*')"
|
||||||
CZ_EXT="${CZ_EXT:-$(chezmoi source-path "${@}")/.chezmoiexternal.yaml.tmpl}"
|
CZ_EXT="${CZ_EXT:-$(chezmoi source-path "${@}")/.chezmoiexternal.yaml.tmpl}"
|
||||||
|
|
Loading…
Reference in New Issue