Skip to content
Permalink
Browse files

helper to keep me informed when vars are added to my environment

  • Loading branch information
robacarp committed Nov 22, 2019
1 parent 18b6af9 commit 2025b57a8508ab65ff1b0da41715ba57b3add83f
Showing with 22 additions and 0 deletions.
  1. +2 −0 .config/fish/config.fish
  2. +20 −0 .config/fish/functions/_unknown_env_vars.fish
@@ -68,6 +68,8 @@ function fish_prompt

set -l dirty (math $stats[3] + $stats[2] + $stats[4])

_unknown_env_vars

# previous command status if nonzero
if test $previous_command -gt 0
echo -s -n (set_color -b red) $previous_command (set_color normal) " "
@@ -0,0 +1,20 @@
function _unknown_env_vars
# env vars which should never be shown
set -l env_var_blacklist "ASDF_DIR" "HOME" "LANG" "LOGNAME" "LaunchInstanceID" "PATH" "PKG_CONFIG_PATH" "PWD" "SECURITYSESSIONID" "SHELL" "SHLVL" "SSH_AUTH_SOCK" "TERM" "TERM_PROGRAM" "TERM_PROGRAM_VERSION" "TERM_SESSION_ID" "TMPDIR" "USER" "XPC_FLAGS" "XPC_SERVICE_NAME"

set -l env_var_names (printenv | awk -F '=' '{print $1}')

set -l vars_to_show

for var in $env_var_names
if ! contains $var $env_var_blacklist
set -a vars_to_show $var
end
end

for var in $vars_to_show
echo -s (set_color -d grey) "$var" (set_color black) "$$var"
end

echo -n (set_color normal)
end

0 comments on commit 2025b57

Please sign in to comment.
You can’t perform that action at this time.