From b5630674a29a31430f73bf908a5758d1b8e90b6f Mon Sep 17 00:00:00 2001 From: Jason Morganson <128727+jasonmorganson@users.noreply.github.com> Date: Sat, 26 Oct 2024 11:30:08 -0400 Subject: [PATCH] Conditional guard --- home/dot_profile.tmpl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/home/dot_profile.tmpl b/home/dot_profile.tmpl index 75807bf3..94963d08 100644 --- a/home/dot_profile.tmpl +++ b/home/dot_profile.tmpl @@ -28,12 +28,14 @@ PATH="$HOME/.rye/shims:$HOME/.local/bin:$HOME/.orbstack/bin:/opt/homebrew/bin:/u LS_COLORS={{ output "pkgx" "vivid" "--color-mode" "8-bit" "generate" "one-dark" | trim | quote }} #GitHub -{{ $user := fromJson (output "sh" "-c" "pkgx gh api https://api.github.com/user && true || echo '{}'") }} +{{- $user := fromJson (output "sh" "-c" "pkgx gh api https://api.github.com/user 2>/dev/null || true") -}} +{{- if and $user.login $user.name $user.id }} GITHUB_USER={{ $user.login | quote }} GIT_AUTHOR_NAME={{ $user.name | quote }} GIT_AUTHOR_EMAIL={{ printf "%v+%s@users.noreply.github.com" $user.id $user.login | quote }} GIT_COMMITTER_NAME=$GIT_AUTHOR_NAME GIT_COMMITTER_EMAIL=$GIT_AUTHOR_EMAIL +{{- end }} # Bash BASH_SILENCE_DEPRECATION_WARNING=1