This repository has been archived on 2022-02-20. You can view files and clone it, but cannot push or open issues/pull-requests.
bash-shell-host/all/modules/vscode.sh

22 lines
515 B
Bash
Executable File

#!/bin/bash
command -v code >/dev/null 2>&1 || exit
# set default home here
# can pass
vscode () {
#local home=$HOME
local home=/opt/vscode
home=${VSCODE_HOME:-$home}
[[ $1 == "-h" ]] && home=$2 && shift 2
mkdir -p $home
[[ $? -ne 0 ]] && echo "unable to set vscode home at $home, aborting" && return 1
exts=${home}/extensions
user=${home}/user
exe=$(command -v code)
$exe --user-data-dir=$user --extensions-dir=$exts "$@"
}
# # if script was executed then call the function
(return 0 2>/dev/null) || vscode $@