This repository has been archived on 2022-02-20. You can view files and clone it, but cannot push or open issues/pull-requests.
2021-01-30 11:45:46 -08:00
|
|
|
#!/bin/bash
|
|
|
|
|
2021-10-19 11:01:32 -07:00
|
|
|
VSCODE_BIN=$(command -v code)
|
|
|
|
VSCODE_BIN=${VSCODE_BIN:-$(command -v codium)}
|
|
|
|
[[ $VSCODE_BIN ]] || {
|
|
|
|
echo "no vscode binary on machine"
|
|
|
|
exit
|
|
|
|
}
|
2021-02-05 12:21:17 -08:00
|
|
|
# set default home here
|
2021-10-19 11:01:32 -07:00
|
|
|
# can pass
|
|
|
|
vscode() {
|
|
|
|
#local home=$HOME
|
|
|
|
local home=/opt/vscode
|
|
|
|
home=${VSCODE_HOME:-$home}
|
|
|
|
[[ $1 == "-h" ]] && home=$2 && shift 2
|
|
|
|
mkdir -p ${home}/${USER}
|
|
|
|
[[ $? -ne 0 ]] && echo "unable to set vscode home at $home/$USER, aborting" && return 1
|
|
|
|
exts=${home}/${USER}/extensions
|
|
|
|
user=${home}/${USER}/data
|
|
|
|
echo $VSCODE_BIN --user-data-dir=$user --extensions-dir=$exts "$@"
|
|
|
|
$VSCODE_BIN --user-data-dir=$user --extensions-dir=$exts "$@"
|
2021-01-30 11:45:46 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
# # if script was executed then call the function
|
|
|
|
(return 0 2>/dev/null) || vscode $@
|