Created
March 24, 2022 09:16
-
-
Save phdd/5fbad472e80f48e3a76a2533c2f28a97 to your computer and use it in GitHub Desktop.
ZSH Plugin - Visual Studio Code Profiles
This file contains hidden or 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
VSCODE_BIN=`which code` | |
code_with_profile() { | |
while true; do | |
case "$1" in | |
-p|--profile) | |
PROFILE_NAME="$2" | |
shift 2 | |
;; | |
--) | |
shift | |
break | |
;; | |
*) | |
break; | |
;; | |
esac | |
done | |
if [[ "$PROFILE_NAME" =~ "^[a-zA-Z0-9]+$" ]]; then | |
mkdir -p ~/.vscode-profiles/$PROFILE_NAME/extensions | |
mkdir -p ~/.vscode-profiles/$PROFILE_NAME/data | |
$VSCODE_BIN --extensions-dir ~/.vscode-profiles/$PROFILE_NAME/extensions --user-data-dir ~/.vscode-profiles/$PROFILE_NAME/data $1 | |
else | |
$VSCODE_BIN $1 | |
fi | |
} | |
alias code="code_with_profile" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment