Created
December 15, 2024 04:07
-
-
Save zcutlip/aaf8e076398f0bb0c78ba18a9e8af62d to your computer and use it in GitHub Desktop.
ZSH: check for vscode before running 1Password `op completion`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 'op' completion for some reason causes VSCode to trigger a | |
# "would like to access data from other apps" prompt | |
# this happens when vscode or an extension sources your .zshrc | |
# we need to check for VSCODE_RESOLVING_ENVIRONMENT, since vscode and | |
# some extensions set that | |
# We ALSO need to check TERM_PROGRAM since opening an interactive terminal session | |
# within vscode will *also* trigger the TCC prompt | |
if [ -z "$VSCODE_RESOLVING_ENVIRONMENT" ] && [ "$TERM_PROGRAM" != "vscode" ]; | |
then | |
# initialize 1Password cli completions if 'op' exists | |
if _command_exists 'op'; | |
then | |
eval "$(op completion zsh)"; compdef _op op | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment