Skip to content

Commit

Permalink
Add lost of guards
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonmorganson committed Oct 26, 2024
1 parent ae76b07 commit 5a4800e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions home/dot_profile.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,17 @@ 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 2>/dev/null || true") -}}
{{- if and (index $user "login") (index $user "name") (index $user "id") }}
GITHUB_USER={{ $user.login | quote }}
GIT_AUTHOR_NAME={{ $user.name | quote }}
GIT_AUTHOR_EMAIL={{ printf "%v+%[email protected]" $user.id $user.login | quote }}
{{- $output := output "sh" "-c" "pkgx gh api https://api.github.com/user 2>/dev/null || true" -}}
{{- if $output -}}
{{- $json := (fromJson $output | default dict) -}}
{{- if and (index $json "login") (index $json "name") (index $json "id") }}
GITHUB_USER={{ $json.login | quote }}
GIT_AUTHOR_NAME={{ $json.name | quote }}
GIT_AUTHOR_EMAIL={{ printf "%v+%[email protected]" $json.id $json.login | quote }}
GIT_COMMITTER_NAME=$GIT_AUTHOR_NAME
GIT_COMMITTER_EMAIL=$GIT_AUTHOR_EMAIL
{{- end }}
{{- end }}

# Bash
BASH_SILENCE_DEPRECATION_WARNING=1
Expand Down

0 comments on commit 5a4800e

Please sign in to comment.