From e0e46a7a1ac3acb4d3c1fe722e5097292b23222b Mon Sep 17 00:00:00 2001 From: Fredrik Ekre Date: Tue, 10 Jan 2023 09:38:31 +0100 Subject: [PATCH] [gh] Add gh wrapper that fetches token from bw. --- .bashrc.dotfiles | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.bashrc.dotfiles b/.bashrc.dotfiles index b10958f..fdb8cd9 100644 --- a/.bashrc.dotfiles +++ b/.bashrc.dotfiles @@ -97,3 +97,11 @@ if command -v bw &> /dev/null ; then fi } fi + +# Wrap gh to fetch auth token from bw +if command -v gh &> /dev/null ; then + function gh () { + local TOKEN=${GITHUB_TOKEN:-$(trap '' INT; bw get notes a8aec2cf-0600-4067-b6a6-d2370132f24f)} + GITHUB_TOKEN=${TOKEN} $(which gh) "$@" + }; +fi