Compare commits

...

5 commits

Author SHA1 Message Date
Lockszmith (wsl@Sygin)
b2009f3948 chezmoi invocation improvements/fixes 2025-04-09 21:32:21 -04:00
Lockszmith (wsl@Sygin)
94752b1b5e add television fuzzy searcher 2025-04-09 21:32:01 -04:00
Lockszmith (wsl@Sygin)
ba76c66c25 reset terminal only once 2025-04-09 21:31:41 -04:00
Lockszmith (wsl@Sygin)
77b49ef219 .chezmoiexternal syntax improvments
- always include 'staticly defined' (aka. fast) yaml entries
- default tgz/zip assignment on cargo-binstall
2025-04-09 21:31:09 -04:00
Lockszmith (wsl@Sygin)
58c86a7e81 implement an old chezmoi cd idea of mine 2025-04-09 20:50:05 -04:00
3 changed files with 30 additions and 12 deletions

View file

@ -17,10 +17,11 @@
# executable bool false Add executable_ attribute to file
# path string none Path to file in archive
*/}}
{{- $defaultRefresh := "168h" -}}
{{- if (env "CZ_EXTR") -}}
{{/* Initialize template variables */}}
{{- $myArch := "" -}}
{{- $defaultRefresh := "168h" -}}
{{- $externals := dict -}}
{{/*
@ -76,10 +77,7 @@
"refreshPeriod" $defaultRefresh
) -}}{{- end -}}{{- end -}}{{- end -}}
{{- $archive_type := "zip" -}}
{{- if (eq .chezmoi.os "linux" ) -}}
{{- $archive_type = "tgz" -}}
{{- end -}}
{{- $archive_type := or (get (dict "linux" "tgz") .chezmoi.os) "zip" }}
{{- with $app_name := "cargo-binstall" -}}
{{- with $repo := (printf "%s/%s" "cargo-bins" $app_name) -}}
{{- with $version := (gitHubLatestRelease $repo).GetTagName -}}
@ -91,6 +89,16 @@
"refreshPeriod" $defaultRefresh
) -}}{{- end -}}{{- end -}}{{- end -}}
{{- with $app_name := "tv" -}}
{{- with $repo := (printf "%s/%s" "alexpasmantier" "television") -}}
{{- with $version := (gitHubLatestRelease $repo).GetTagName -}}
{{- $_ := set $externals (printf ".local/bin/%s" $app_name) (dict
"type" "archive-file"
"url" (printf "https://github.com/%s/releases/download/%s/%s-%s-%s.tar.gz" $repo $version $app_name $version $myArch)
"path" (printf "%s-%s-%s/%s" $app_name $version $myArch $app_name)
"refreshPeriod" $defaultRefresh
) -}}{{- end -}}{{- end -}}{{- end -}}
{{- if (eq .chezmoi.os "linux") -}}
{{- with $app_name := "vivid" -}}
{{- with $repo := (printf "%s/%s" "sharkdp" $app_name) -}}
@ -268,7 +276,12 @@
"refreshPeriod" $defaultRefresh
) -}}{{- end -}}{{- end -}}{{- end }}{{- end -}}
{{- $externals | toYaml }}
{{- $externals | toYaml -}}
{{- else -}}
# This is a truncated version of .chezmoiexternal because CZ_EXTR env is undefined
{{- end }}
".config/sz.env/lib/ble.sh.curl":
type: "archive"
url: "https://github.com/akinomyoga/ble.sh/releases/download/nightly/ble-nightly.tar.xz"
@ -296,7 +309,3 @@
executable: true
refreshPeriod: "{{ $defaultRefresh }}"
{{- end -}}
{{- else -}}
# .chezmoiexternal is disabled because CZ_EXTR env is undefined
{{- end -}}

View file

@ -5,4 +5,5 @@ if [[ ! "$-" =~ i ]]; then
echo "Non interactive session ($-) , stopping load of shell environment" 1>&2
else
${NO_RESET:+:} reset
export NO_RESET=1
fi

View file

@ -13,9 +13,17 @@ if is_cmd 'chezmoi'; then
complete -F _complete_alias czg
czcd() {
cd "$(chezmoi source-path "${@}")"
chezmoi() {
${SET_X:-:} -x
case "$1" in
"cd") cd "$(chezmoi source-path "${@:2}")" ;;
"edit") ${VISUAL:-${EDITOR:-vi}} $(chezmoi source-path "${@:2}") ;;
"source-path") printf '%s\n' "${@:2}" | xargs -r chezmoi source-path ;;
*) command chezmoi "${@}" ;;
esac
${SET_X:-:} +x
}
czcd() { chezmoi cd "${@}"; }
czedext() {
local CZ_EXT="$(find $(chezmoi source-path) -mindepth 1 -maxdepth 1 -name '.chezmoiexternal.*')"
CZ_EXT="${CZ_EXT:-$(chezmoi source-path "${@}")/.chezmoiexternal.yaml.tmpl}"