2023-02-07 13:03:18 -08:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# make generic for an app
|
|
|
|
function vscode_install {
|
|
|
|
local src
|
|
|
|
local target
|
|
|
|
local dir="$(dirname $(realpath "${BASH_SOURCE:-$0}"))"
|
|
|
|
local script=$dir/vscode.func
|
2023-03-07 11:07:19 -08:00
|
|
|
[[ ! $(command -v code) ]] && echo "vscode binary (code) at must be installed first" && return 1
|
|
|
|
[[ ! -f $script ]] && echo can not find vscode function script at $script && return 2
|
2023-02-07 13:03:18 -08:00
|
|
|
target=${1:-/opt/bin}/vscode
|
2023-03-07 11:07:19 -08:00
|
|
|
chmod +rx $script
|
|
|
|
ln -sf $script $target
|
|
|
|
echo link to $script created at $target
|
2023-02-07 13:03:18 -08:00
|
|
|
ls -la /opt/bin | grep vscode
|
|
|
|
echo with permissions
|
2023-03-07 11:07:19 -08:00
|
|
|
ls -la $script
|
2023-02-07 13:03:18 -08:00
|
|
|
}
|
|
|
|
|
2023-03-07 11:07:19 -08:00
|
|
|
|
2023-02-07 13:03:18 -08:00
|
|
|
|
|
|
|
# if script was executed then call the function
|
|
|
|
(return 0 2>/dev/null) || vscode_install $@
|