Skip to content

Instantly share code, notes, and snippets.

@phdd
Created March 24, 2022 09:16
Show Gist options
  • Save phdd/5fbad472e80f48e3a76a2533c2f28a97 to your computer and use it in GitHub Desktop.
Save phdd/5fbad472e80f48e3a76a2533c2f28a97 to your computer and use it in GitHub Desktop.
ZSH Plugin - Visual Studio Code Profiles
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