Files
sunhat/configs/dotfiles/espanso/bin/get_login
2025-07-09 13:34:24 -05:00

20 lines
595 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# 1) load your shell exports if not already present:
#if [[ -z "${BW_SESSION:-}" ]]; then
#[[ -f "$HOME/.bashrc" ]] && source "$HOME/.bashrc"
#[[ -f "$HOME/.profile" ]] && source "$HOME/.profile"
#fi
source ~/.local/share/sunhat/defaults/bash/api_keys
# 2) if still empty, unlock once and export:
#if [[ -z "${BW_SESSION:-}" ]]; then
#export BW_SESSION=$(bw unlock --raw)
#fi
# 3) fetch and print user<TAB>pass<NEWLINE>
printf '%s\t%s\n' \
"$(bw --session "$BW_SESSION" get username "$1")" \
"$(bw --session "$BW_SESSION" get password "$1")"