Skip to content

Commit

Permalink
Make debugging easier
Browse files Browse the repository at this point in the history
Add `debug_out` to make debugging easier, and `zqs {en,dis}able-debug-mode` to toggle it.

Signed-off-by: Joe Block <jpb@unixorn.net>
  • Loading branch information
unixorn committed Apr 3, 2024
1 parent 8903032 commit 4e0efcb
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions zsh/.zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ function can_haz() {
which "$@" > /dev/null 2>&1
}

function zqs-debug() {
if [[ -f ~/.zqs-debug-mode ]]; then
echo $@
fi
}

# Fix weirdness with intellij
if [[ -z "${INTELLIJ_ENVIRONMENT_READER}" ]]; then
export POWERLEVEL9K_INSTANT_PROMPT='quiet'
Expand Down Expand Up @@ -326,18 +332,21 @@ fi

onepassword-agent-check() {
# 1password ssh agent support
zqs-debug "Checking for 1password"
if [[ $(_zqs-get-setting use-1password-ssh-agent true) == 'true' ]]; then
if [[ "$(uname -s)" == "Darwin" ]]; then
local ONE_P_SOCK=~/Library/Group\ Containers/2BUA8C4S2C.com.1password/t/agent.sock
fi
if [[ "$(uname -s)" == "Linux" ]]; then
local ONE_P_SOCK=~/.1password/agent.sock
fi
zqs-debug "ONE_P_SOCK=$ONE_P_SOCK"
if [[ -r "$ONE_P_SOCK" ]];then
export SSH_AUTH_SOCK="$ONE_P_SOCK"
else
echo "Quickstart is set to use 1Password's ssh agent, but $ONE_P_SOCK isn't readable!"
fi
zqs-debug "Set SSH_AUTH_SOCK to $SSH_AUTH_SOCK"
fi
}

Expand Down Expand Up @@ -891,6 +900,12 @@ function zqs() {
'enable-control-c-decorator')
zqs-quickstart-enable-control-c-decorator
;;
'disable-debug-mode')
rm -f ~/.zqs-debug-mode
;;
'enable-debug-mode')
date > ~/.zqs-debug-mode
;;

'disable-diff-so-fancy')
echo "Disabling diff-so-fancy plugin. New ZSH sessions will no longer use the plugin."
Expand Down

0 comments on commit 4e0efcb

Please sign in to comment.