Skip to content

Commit

Permalink
fix(fish): gh auth status
Browse files Browse the repository at this point in the history
  • Loading branch information
scottames committed Aug 13, 2024
1 parent ba7de3c commit c719a00
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
5 changes: 2 additions & 3 deletions home/private_dot_config/fish/custom_functions.d/aqua.fish
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ function aqua \
--description "Declarative CLI Version manager. Runs behind op, if installed for GitHub API auth." \
--wraps aqua

set -l _KEYRING_AUTH (GITHUB_TOKEN="" command gh auth status | grep 'keyring' | grep '✓ Logged in')
if [ $_KEYRING_AUTH ]
set -e GITHUB_TOKEN
set -l _GH_AUTH_STATUS (GITHUB_TOKEN="" command gh auth status)
if string match -q -r "✓ Logged in" $_GH_AUTH_STATUS
set -l GITHUB_TOKEN (gh auth token)

command aqua $argv
Expand Down
9 changes: 4 additions & 5 deletions home/private_dot_config/fish/custom_functions.d/gh.fish
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ function gh \
--description "GitHub CLI. Runs behind op, if installed for GitHub API auth." \
--wraps gh

set -l _KEYRING_AUTH (GITHUB_TOKEN="" command gh auth status | grep 'keyring' | grep '✓ Logged in')
if [ $_KEYRING_AUTH ]
set -e GITHUB_TOKEN

command gh $argv
set -l _GH_AUTH_STATUS (GITHUB_TOKEN="" command gh auth status)
# set -l _KEYRING_AUTH (GITHUB_TOKEN="" command gh auth status | grep 'keyring' | grep -q '✓ Logged in')
if string match -q -r "✓ Logged in" $_GH_AUTH_STATUS
GITHUB_TOKEN="" command gh $argv
else if [ $HAS_OP ]
op run -- gh $argv
else
Expand Down

0 comments on commit c719a00

Please sign in to comment.