Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: fix
packages:
- "@typespec/standalone-cli"
---

Fix install script adding duplicate PATH entries to shell config files (`.bashrc`, `.zshrc`, etc.) on subsequent runs. The script now detects if TypeSpec is already configured and skips the shell update. Also fix `--skip-shell` flag which was using an inconsistent variable name and had no effect.
14 changes: 13 additions & 1 deletion packages/standalone/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ parse_args() {
# shift # past value
# ;;
-s | --skip-shell)
SKIP_SHELL="true"
skip_shell="true"
shift # past argument
;;
--version)
Expand Down Expand Up @@ -188,6 +188,10 @@ setup_shell() {
if [ "$CURRENT_SHELL" = "zsh" ]; then
CONF_FILE=${ZDOTDIR:-$HOME}/.zshrc
ensure_containing_dir_exists "$CONF_FILE"
if grep -qF "TYPESPEC_PATH" "$CONF_FILE" 2> /dev/null; then
info "TypeSpec path already configured in $CONF_FILE, skipping."
return
fi
echo "Installing for Zsh. Appending the following to $CONF_FILE:"
{
echo ''
Expand All @@ -201,6 +205,10 @@ setup_shell() {
elif [ "$CURRENT_SHELL" = "fish" ]; then
CONF_FILE=$HOME/.config/fish/conf.d/tsp.fish
ensure_containing_dir_exists "$CONF_FILE"
if grep -qF "TYPESPEC_PATH" "$CONF_FILE" 2> /dev/null; then
info "TypeSpec path already configured in $CONF_FILE, skipping."
return
fi
echo "Installing for Fish. Appending the following to $CONF_FILE:"
{
echo ''
Expand All @@ -218,6 +226,10 @@ setup_shell() {
CONF_FILE=$HOME/.bashrc
fi
ensure_containing_dir_exists "$CONF_FILE"
if grep -qF "TYPESPEC_PATH" "$CONF_FILE" 2> /dev/null; then
info "TypeSpec path already configured in $CONF_FILE, skipping."
return
fi
echo "Installing for Bash. Appending the following to $CONF_FILE:"
{
echo ''
Expand Down
Loading