Skip to content

Add colour to the confirm in the Ahoy config #2363

@AlexSkrypnyk

Description

@AlexSkrypnyk

  confirm:
    cmd: |
      if [ -z "${AHOY_CONFIRM_RESPONSE}" ]; then
        read -r -p "$( echo -e "\033[31m>> $1\033[0m \033[2m[y/N]\033[0m " )" AHOY_CONFIRM_RESPONSE
        if [ "${AHOY_CONFIRM_RESPONSE}" != "y" ] && [ "${AHOY_CONFIRM_RESPONSE}" != "true" ]; then
          echo "The operation was canceled."
          exit 1
        fi
      else
        if [ "${AHOY_CONFIRM_WAIT_SKIP}" != "1" ]; then
          echo -e "\033[31m>> $1\033[0m \033[2m[y/N] ${AHOY_CONFIRM_RESPONSE}\033[0m"
          echo "Waiting for 3 seconds... Press Ctrl+C to cancel."
          sleep 3
        fi
      fi
    hide: true

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Released in 1.37.0

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions