mirror of
https://github.com/prdlk/dotfiles.git
synced 2026-11-08 04:57:36 +00:00
feat(scripts): automate tool and AUR package installation setup
This commit is contained in:
1 parent
fd1fd0cc16
commit
58b6c10779
4 files changed
+99
-20
No files matched your search
@@ -1,12 +1,25 @@
|
||||
#!/bin/sh
|
||||
#!/usr/bin/env fish
|
||||
# Install gh extensions declared in .chezmoidata/packages.yaml.
|
||||
# A fish script, so fish's config (~/.config/fish, applied before after-scripts
|
||||
# run) is sourced first: PATH (mise, ~/.local/bin, ~/.cargo/bin) and
|
||||
# GITHUB_TOKEN (conf.d/10-env.fish) match a fish session.
|
||||
# gh_extensions hash: {{ .packages.shared.gh_extensions | toJson | sha256sum }}
|
||||
set -eu
|
||||
|
||||
command -v gh >/dev/null 2>&1 || { echo "warning: gh not installed — skipping extensions" >&2; exit 0; }
|
||||
gh auth status >/dev/null 2>&1 || { echo "warning: gh not authenticated — run 'gh auth login', then 'chezmoi apply' again" >&2; exit 0; }
|
||||
if not command -q gh
|
||||
echo "warning: gh not installed — skipping extensions" >&2
|
||||
exit 0
|
||||
end
|
||||
if not gh auth status >/dev/null 2>&1
|
||||
echo "warning: gh not authenticated — run 'gh auth login', then 'chezmoi apply' again" >&2
|
||||
exit 0
|
||||
end
|
||||
|
||||
installed=$(gh extension list 2>/dev/null | cut -f2 || true)
|
||||
{{ range .packages.shared.gh_extensions }}
|
||||
echo "$installed" | grep -qxF "{{ . }}" || gh extension install "{{ . }}"
|
||||
{{ end }}
|
||||
set -l installed (gh extension list 2>/dev/null | string split -f2 \t)
|
||||
set -l failed
|
||||
for ext in{{ range .packages.shared.gh_extensions }} {{ . | quote }}{{ end }}
|
||||
contains -- $ext $installed; or gh extension install $ext; or set -a failed $ext
|
||||
end
|
||||
if set -q failed[1]
|
||||
echo "error: gh extension install failed for: $failed" >&2
|
||||
exit 1
|
||||
end
|
||||
Reference in new issue
Block a user