scripts/development/vscodium/vscodium-user-ext.sh

50 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
#### Variables
EXTENSIONS_PHP=(xdebug.php-debug zobo.php-intellisense lkrms.pretty-php)
EXTENSIONS_MISC=(foxundermoon.shell-format)
#### Functions
check_notroot() {
if ! [ "$EUID" -ne 0 ]; then
echo "Must be non-root to run $0"
exit
fi
}
choice() {
echo -ne "[y/n]"
while true; do
read -rN1 input
echo " "
case $input in
[yY][eE][sS] | [yY])
return 0
break
;;
[nN][oO] | [nN])
return 1
;;
esac
done
}
#### Main
check_notroot
echo -ne "\nYou want to install vscodium extensions for php (${EXTENSIONS_PHP[@]})? "
if choice 2>/dev/null; then
for EXT_NAME in "${EXTENSIONS_PHP[@]}"; do
codium --force --install-extension $EXT_NAME
done
fi
echo -ne "\nYou want to install vscodium misc extensions (${EXTENSIONS_MISC[@]})? "
if choice 2>/dev/null; then
for EXT_NAME in "${EXTENSIONS_MISC[@]}"; do
codium --force --install-extension $EXT_NAME
done
fi