diff --git a/_src.posix/.chezmoiexternal.yaml.tmpl b/_src.posix/.chezmoiexternal.yaml.tmpl index 34411ff..87cd982 100644 --- a/_src.posix/.chezmoiexternal.yaml.tmpl +++ b/_src.posix/.chezmoiexternal.yaml.tmpl @@ -99,23 +99,8 @@ "refreshPeriod" $defaultRefresh ) -}}{{- end -}}{{- end -}}{{- end -}} -{{- if (eq .chezmoi.os "linux") -}} -{{- with $app_name := "vivid" -}} -{{- with $repo := (printf "%s/%s" "sharkdp" $app_name) -}} -{{- 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) - "executable" true - "refreshPeriod" $defaultRefresh -) -}}{{- end -}}{{- end -}}{{- end -}} -{{- end -}}{{/* if linux */}} - -{{ $myArch = (printf "%s-%s" .sz.os.arch_alt "unknown-linux-gnu" )}} - {{- with $app_name := "eza" -}} -{{- with $cargo_bin_url := (output "sh" "-c" ( +{{- with $bin_url := (output "sh" "-c" ( list "cargo-binstall --log-level debug --dry-run --no-track --no-confirm --json-output" $app_name @@ -126,12 +111,30 @@ {{- with $repo := (printf "%s/%s" "eza-community" $app_name) -}} {{- $_ := set $externals (printf ".local/bin/%s" $app_name) (dict "type" "archive-file" - "url" $cargo_bin_url + "url" $bin_url "path" $app_name "executable" true "refreshPeriod" $defaultRefresh ) -}}{{- end -}}{{- end -}}{{- end -}} +{{- with $app_name := "vivid" -}} +{{- with $bin_url := (output "sh" "-c" ( + list + "cargo-binstall --log-level debug --dry-run --no-track --no-confirm --json-output" + $app_name + "| jq \".fields | select ( .message == \\\"Downloading package\\\" )\"" + | join " ") | fromJson + ).url +-}} +{{- with $path := trimSuffix ".zip" (trimSuffix ".tgz" (trimSuffix ".tar" (trimSuffix ".gz" (base $bin_url)))) -}} +{{- $_ := set $externals (printf ".local/bin/%s" $app_name) (dict + "type" "archive-file" + "url" $bin_url + "path" (printf "%s/%s" $path $app_name) + "executable" true + "refreshPeriod" $defaultRefresh +) -}}{{- end -}}{{- end -}}{{- end -}} + {{/* # valid arch strings: # darwin_amd64 @@ -178,10 +181,7 @@ # win */}} -{{- $myArch = .sz.os.short -}} -{{- if eq .chezmoi.os "linux" -}} -{{- $myArch = (printf "%s-%s" .chezmoi.os .sz.os.arch_alt) -}} -{{- end -}} +{{- $myArch := or (get (dict "linux" (printf "%s-%s" .chezmoi.os .sz.os.arch_alt)) .chezmoi.os) .sz.os.short }} {{- with $app_name := "gitui" -}} {{- with $repo := (printf "%s/%s" "extrawurst" $app_name) -}} @@ -194,7 +194,6 @@ "refreshPeriod" $defaultRefresh ) -}}{{- end -}}{{- end -}}{{- end -}} - {{/* # valid arch strings: # darwin-amd64 @@ -321,3 +320,4 @@ executable: true refreshPeriod: "{{ $defaultRefresh }}" {{- end -}} +