Fixes ASDF completion symlink and adds GH CLI

This commit is contained in:
Brian Zalewski 2023-11-05 02:59:47 +00:00
parent be45dcdaf8
commit 523ead0cc4
3 changed files with 31 additions and 1 deletions

View file

@ -0,0 +1,28 @@
{{- if (ne .host.distro.family "windows") -}}
#!/usr/bin/env bash
# @file GH (GitHub CLI) Install
# @brief Ensures GH (the GitHub CLI) is installed via Homebrew
# @description
# This script installs GH via Homebrew. GH is included as a dependency for
# generating the global git config helper since GH provides a credential
# helper that can be used to authenticate calls on `github.com`.
{{ includeTemplate "universal/profile-before" }}
{{ includeTemplate "universal/logg-before" }}
### Ensure gh is installed
if ! command -v gh > /dev/null; then
if command -v brew; then
logg 'Installing gh via Homebrew'
brew install gh || GH_EXIT_CODE=$?
if [ -n "$GH_EXIT_CODE" ]; then
logg error 'gh was not successfully installed via Homebrew'
fi
else
logg 'brew is unavailable. Cannot use it to perform a system installation of node.'
fi
else
logg 'gh is available'
fi
{{ end -}}

View file

@ -62,10 +62,12 @@
[credential]
helper = cache --timeout=3600
credentialStore = {{ if eq .host.distro.id "darwin" }}keychain{{ else }}{{ if eq .host.distro.id "windows" }}wincredman{{ else }}secretservice{{ end }}{{ end }}
{{ if (lookPath "asdf") -}}
[credential "https://github.com"]
helper = !{{- output "which" "gh" | trim }} auth git-credential
[credential "https://gist.github.com"]
helper = !{{- output "which" "gh" | trim }} auth git-credential
{{- end -}}
[delta]
features = Betelgeuse
[delta "Betelgeuse"]

View file

@ -1,3 +1,3 @@
{{- if (lookPath "asdf") -}}
{{- output "echo" "${XDG_DATA_HOME:-$HOME/.local/share}/asdf/completions/_asdf" -}}
{{ .host.home }}/.local/share/asdf/completions/_asdf
{{- end -}}