diff --git a/CLAUDE.md b/CLAUDE.md index b30277f..f399dc2 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -21,6 +21,7 @@ and adds `bin/` to PATH. `$LWS` points to repo root. - `can_run ` — check if command is available - `is_slow_init` / `is_fast_init` — check `LWS_FAST` mode - `is_interactive_shell` — true when `[[ $- == *i* ]]` +- `is_stdin_terminal` — true when stdin is a terminal (`tty` would return a device, not `not a tty`) - `is_wsl` — detect WSL environment - `is_ssh_session` — true when logged in over SSH - `true_false ` — normalize `1/true/yes` to boolean diff --git a/functions.sh b/functions.sh index 7a430ad..f835737 100644 --- a/functions.sh +++ b/functions.sh @@ -9,6 +9,10 @@ function is_interactive_shell() { [[ $- == *i* ]] } +function is_stdin_terminal() { + [[ -t 0 ]] +} + function is_fast_init() { (( $LWS_FAST )) } diff --git a/rc/gpg.sh b/rc/gpg.sh new file mode 100644 index 0000000..672a24b --- /dev/null +++ b/rc/gpg.sh @@ -0,0 +1,6 @@ +# shellcheck shell=bash + +if is_stdin_terminal && can_run gpg; then + GPG_TTY=$(tty) + export GPG_TTY +fi