Repository: starship/starship
File: install/install.sh (Shell)

Code before:
}

set_interrupt_handler() {
  trap 'echo; error "Interrupted (please re-run with the '--yes' option)"; exit 130' INT
}

confirm() {
  if [ -z "${FORCE-}" ]; then
    set_interrupt_handler
    printf "%s " "${MAGENTA}?${NO_COLOR} $* ${BOLD}[y/N]${NO_COLOR}"
    set +e
    read -r yn </dev/tty
    trap - INT
    yn=$(echo "$yn" | tr '[:upper:]' '[:lower:]')
    rc=$?
    set -e
    if [ $rc -ne 0 ]; then
      error "Error reading from prompt (please re-run with the '--yes' option)"
      exit 1
    fi
    if [ "$yn" != "y" ] && [ "$yn" != "yes" ]; then
      if [ "$yn" = "n" ] || [ "$yn" = "no" ]; then
        set_interrupt_handler
        set +e
        printf "${MAGENTA}?${NO_COLOR} Where would you like to install Starship? ${GREY}(e.g., /usr/local/bin)${NO_COLOR}\n"
        read -p "${MAGENTA}?${NO_COLOR} Install Starship ${GREEN}${VERSION}${NO_COLOR} to: " path
        trap - INT
        rc=$?
        set -e
        BIN_DIR=$path
        if [ $rc != 0 ] || [ -z "$path" ]; then
          if [ -z "$path" ]; then
            echo
          fi
          error "Error reading from prompt (please re-run with '--yes' or provide path)"
          exit 1
        fi
      else
        if [ -z "$yn" ]; then
          echo
        fi
        error 'Aborting (please answer "yes" to continue)'
        exit 1
      fi
    fi
  fi
}

check_bin_dir() {
  bin_dir="${1%/}"


Review comment (suggestion):
Sorry for the nitpicking, but two small UX tweaks! 
The first line is more of an explanation than a question, and for input prompts `>` is more natural than `?`:

```suggestion
        printf "Where would you like to install Starship? ${GREY}(e.g., /usr/local/bin)${NO_COLOR}\n"
        read -p "> Install Starship ${GREEN}${VERSION}${NO_COLOR} to: " path
```

This creates a cleaner flow:
```
  Where would you like to install Starship? (e.g., /usr/local/bin)
  > Install Starship latest to: |
```

Code after:
}

set_interrupt_handler() {
  trap 'echo; error "Interrupted (please re-run with the '--yes' option)"; exit 130' INT
}

confirm() {
  if [ -z "${FORCE-}" ]; then
    set_interrupt_handler
    printf "%s " "${MAGENTA}?${NO_COLOR} $* ${BOLD}[y/N]${NO_COLOR}"
    set +e
    read -r yn </dev/tty
    trap - INT
    yn=$(echo "$yn" | tr '[:upper:]' '[:lower:]')
    rc=$?
    set -e
    if [ $rc -ne 0 ]; then
      error "Error reading from prompt (please re-run with the '--yes' option)"
      exit 1
    fi
    if [ "$yn" != "y" ] && [ "$yn" != "yes" ]; then
      if [ "$yn" = "n" ] || [ "$yn" = "no" ]; then
        set_interrupt_handler
        set +e
        printf "Where would you like to install Starship? ${GREY}(e.g., /usr/local/bin)${NO_COLOR}\n"
        read -p "> Install Starship ${GREEN}${VERSION}${NO_COLOR} to: " path
        trap - INT
        rc=$?
        set -e
        BIN_DIR=$path
        if [ $rc != 0 ] || [ -z "$path" ]; then
          if [ -z "$path" ]; then
            echo
          fi
          error "Error reading from prompt (please re-run with '--yes' or provide path)"
          exit 1
        fi
      else
        if [ -z "$yn" ]; then
          echo
        fi
        error 'Aborting (please answer "yes" to continue)'
        exit 1
      fi
    fi
  fi
}

check_bin_dir() {
  bin_dir="${1%/}"