34 lines
680 B
Bash
Executable file
34 lines
680 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
# Change this to "code" if you use vscode
|
|
COMMAND="codium"
|
|
|
|
# Location for the environments
|
|
ENVS_BASE=~/.vscode-envs
|
|
mkdir -p $ENVS_BASE
|
|
|
|
# Setting the environment
|
|
ENV=$1
|
|
if [ -z "$ENV" ]; then
|
|
echo "Using default env folder"
|
|
ENV=default
|
|
fi
|
|
|
|
# Directory to open inside the editor
|
|
PLC=$2
|
|
if [ -z "$PLC" ]; then
|
|
PLC="."
|
|
fi
|
|
|
|
# Final setup of the environment
|
|
ENV_BASE=$ENVS_BASE/$ENV
|
|
## User data
|
|
ENV_USR=$ENV_BASE/usr
|
|
## Extensions
|
|
ENV_EXT=$ENV_BASE/ext
|
|
## Create the needed directories if they don't exist
|
|
mkdir -p $ENV_USR
|
|
mkdir -p $ENV_EXT
|
|
|
|
# Start the editor with the custom environment
|
|
$COMMAND --user-data-dir $ENV_USR --extensions-dir $ENV_EXT $PLC
|