Skip to content

Commit

Permalink
Always succeed and leave empty strings on output error
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonmorganson committed Apr 11, 2024
1 parent a3666d6 commit 0d48b0c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions home/dot_config/nushell/scripts/git.nu.tmpl
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
export-env {
load-env {
GIT_AUTHOR_NAME: {{ output "gh" "api" "https://api.github.com/user" "--jq" ".name" | trim | quote }}
GIT_AUTHOR_EMAIL: {{ output "gh" "api" "https://api.github.com/user/public_emails" "--jq" ".[0].email" | trim }}
GIT_AUTHOR_NAME: {{ output "sh" "-c" "pkgx gh api https://api.github.com/user --jq '.name' || true" | trim | quote }}
GIT_AUTHOR_EMAIL: {{ output "sh" "-c" "pkgx gh api https://api.github.com/user/public_emails --jq '.[0].email' || true" | trim | quote }}
}
load-env {
GIT_COMMITTER_NAME: $env.GIT_AUTHOR_NAME
GIT_COMMITTER_EMAIL: $env.GIT_AUTHOR_EMAIL
}
}

2 changes: 1 addition & 1 deletion home/dot_config/nushell/scripts/github.nu.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export-env {
load-env {
GITHUB_USER: {{ output "gh" "api" "https://api.github.com/user" "--jq" ".login" | trim }}
GITHUB_USER: {{ output "sh" "-c" "gh api https://api.github.com/user --jq '.login' || true" | trim | quote }}
}
}

0 comments on commit 0d48b0c

Please sign in to comment.