Skip to content

Commit 0e1a7cd

Browse files
committed
Packages: Extend eget spec with asset, name, and download_only options
1 parent cc3dfa7 commit 0e1a7cd

2 files changed

Lines changed: 36 additions & 3 deletions

File tree

home/.chezmoidata/.package_specs.schema.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,24 @@ $defs:
6767
source:
6868
type: string
6969
description: |
70-
Location of the package (github user/repo, URL, or local path)
70+
Location of the package (github user/repo, URL, or local path)
71+
name:
72+
type: string
73+
description: Output filename (defaults to source repo name if not set)
74+
asset:
75+
description: Asset filter(s) passed to eget --asset (string or list)
76+
oneOf:
77+
- type: string
78+
- type: array
79+
items:
80+
type: string
81+
file:
82+
type: string
83+
description: Glob passed to eget --file to select files for extraction
84+
download_only:
85+
type: boolean
86+
description: Pass --download-only (no extraction)
87+
additionalProperties: false
7188

7289
uvDef:
7390
description: |

home/.chezmoitemplates/install_packages.sh.tmpl

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,17 +189,33 @@ fi
189189
{{ end -}}
190190
{{ if $eget }}
191191
{{ range $name, $pkg := $eget -}}
192+
{{- $egetTo := "~/.local/bin/" -}}
193+
{{- if hasKey $pkg "name" -}}{{- $egetTo = printf "~/.local/bin/%s" $pkg.name -}}{{- end -}}
194+
{{- $egetCmd := printf "eget %s --to %s" ($pkg.source | quote) $egetTo -}}
195+
{{- if hasKey $pkg "asset" -}}
196+
{{- $assets := $pkg.asset -}}
197+
{{- if kindIs "string" $assets -}}{{- $assets = list $assets -}}{{- end -}}
198+
{{- range $a := $assets -}}
199+
{{- $egetCmd = printf "%s --asset %s" $egetCmd ($a | quote) -}}
200+
{{- end -}}
201+
{{- end -}}
202+
{{- if hasKey $pkg "file" -}}
203+
{{- $egetCmd = printf "%s --file %s" $egetCmd ($pkg.file | quote) -}}
204+
{{- end -}}
205+
{{- if and (hasKey $pkg "download_only") $pkg.download_only -}}
206+
{{- $egetCmd = printf "%s --download-only" $egetCmd -}}
207+
{{- end -}}
192208
{{ if hasKey $checks $name -}}
193209
dot::step::start "install {{ $name }} with eget"
194210
if dot::has_command {{ (get $checks $name).command | quote }}; then
195211
dot::step::skipped "already installed"
196212
else
197-
eget {{ $pkg.source | quote }} -t ~/.local/bin/
213+
{{ $egetCmd }}
198214
dot::step::done
199215
fi
200216
{{ else -}}
201217
dot::step::start "install {{ $name }} with eget"
202-
eget {{ $pkg.source | quote }} -t ~/.local/bin/
218+
{{ $egetCmd }}
203219
dot::step::done
204220
{{ end -}}
205221
{{ end -}}

0 commit comments

Comments
 (0)