diff --git a/script/codium_extensions.sh b/script/codium_extensions.sh index 1514e0a..0e00ecd 100755 --- a/script/codium_extensions.sh +++ b/script/codium_extensions.sh @@ -8,7 +8,7 @@ install_codium_extensions() { printf "Error: %s command not in PATH.\n" "$EDITOR" >&2 return 1 fi - printf "Installing extensions for %s\n" "$EDITOR" + printf "\nInstalling extensions for %s\n\n" "$EDITOR" if [ "$EDITOR" = "code" ] || [ "$EDITOR" = "code-insiders" ]; then cat ~/.dotfiles/codium/extensions/marketplace-open-vsx.txt \ ~/.dotfiles/codium/extensions/marketplace-proprietary.txt \ @@ -27,14 +27,15 @@ install_codium_extensions() { fi done <$EXTENSIONS } + if [ -z "$1" ]; then - printf "Error: No editor was given for the codium_extensions.sh script.\n" - printf "Please specify ≥1 editor [code, code-insiders, codium].\n" + printf "\nError: No editor was given for the codium_extensions.sh script.\n" + printf "Please specify ≥1 editor: code code-insiders codium\n" exit 1 fi + for i in "$@"; do EDITOR=$i - # Add editor command to PATH case $i in code) APP="Visual\ Studio\ Code" @@ -46,15 +47,12 @@ for i in "$@"; do APP="VSCodium" ;; esac - # TODO: Figure out how to use CLI without restarting terminal to install - # extensions via Strap. Currently, a terminal restart is needed before the CLI - # can be used. https://code.visualstudio.com/docs/setup/mac - # export PATH="$PATH:/Applications/$APP.app/Contents/Resources/app/bin" - printf "%s\n" $APP - # Install extensions + if [ "$(uname -s)" = "Darwin" ]; then + export PATH="/Applications/$APP.app/Contents/Resources/app/bin:$PATH" + fi if install_codium_extensions; then - printf "install_codium_extensions() successful for %s.\n" "$i" + printf "\nExtensions successfully installed for %s.\n" "$i" else - printf "Error: install_codium_extensions() unsuccessful for %s.\n" "$i" + printf "\nError: extensions not successfully installed for %s.\n" "$i" fi done diff --git a/script/strap-after-setup b/script/strap-after-setup index 72cd381..ab8c171 100755 --- a/script/strap-after-setup +++ b/script/strap-after-setup @@ -10,9 +10,13 @@ echo "-> Running scripts from script/strap-after-setup" ~/.dotfiles/script/npm_globals.sh [ "$(uname -s)" = "Darwin" ] && ~/.dotfiles/script/macos.sh -echo "-> Must install VSCodium CLI before running codium_extensions.sh." -echo "Open the app, then in the command palette, type 'shell command'." -# ~/.dotfiles/script/codium_extensions.sh codium code-insiders +echo "-> Installing VSCode extensions" +CODE_DISTRO=${CODE_DISTRO:-"codium"} +if [ "$(whoami)" = "codespace" ]; then + echo "Error: Codespaces VSCode CLI can't install extensions." +else + ~/.dotfiles/script/codium_extensions.sh "$CODE_DISTRO" +fi # Install Poetry: https://python-poetry.org/docs/ echo "-> Installing Poetry for Python packaging and dependency management"