Sha256: d5dcfaec20cf63a2e00ac8acf0abdd7295b7c12ccfd0d7ff78c4dc4e56d1509e

Contents?: true

Size: 1004 Bytes

Versions: 27

Compression:

Stored size: 1004 Bytes

Contents

#!/bin/bash

DEFAULT_ERROR_CODES="0"

# First arg is the command
# Second arg is the string of acceptable error codes seperated by space. E.g. "0 1"
pre_commit_wrapper () {
  echo "running pre-commit run --all-files --hook-stage=manual ${1}"

  exec 5>&1
  acceptable_errors=${2:-$DEFAULT_ERROR_CODES}
  out=$(pre-commit run --all-files --hook-stage=manual "${1}" | tee >(cat - >&5))
  exit_code=$( echo "$out" | grep -- "- exit code:"  | cut -d":" -f2 | sed 's/[^0-9]*//g' )

  if [[ -n $exit_code ]]; then
    re="([^0-9]|^)$exit_code([^0-9]|$)"
    if ! grep -qE "$re" <<< "$acceptable_errors" ; then
      echo "pre-commit subcommand failed with error_code: $exit_code. See output above"
      exit "$exit_code";
    fi
  fi

  echo "command 'pre-commit run --all-files --hook-stage=manual ${1}' success"
}

rm -rf ./lib/datadog_api_client/v1 ./lib/datadog_api_client/v2 examples/*
pre_commit_wrapper generator
pre_commit_wrapper examples
pre_commit_wrapper format-examples 3
pre_commit_wrapper docs

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
datadog_api_client-2.28.1 generate.sh
datadog_api_client-2.27.1 generate.sh
datadog_api_client-2.26.1 generate.sh
datadog_api_client-2.26.0 generate.sh
datadog_api_client-2.25.0 generate.sh
datadog_api_client-2.24.0 generate.sh
datadog_api_client-2.22.0 generate.sh
datadog_api_client-2.21.0 generate.sh
datadog_api_client-2.20.0 generate.sh
datadog_api_client-2.19.0 generate.sh
datadog_api_client-2.18.0 generate.sh
datadog_api_client-2.17.0 generate.sh
datadog_api_client-2.16.0 generate.sh
datadog_api_client-2.15.0 generate.sh
datadog_api_client-2.14.0 generate.sh
datadog_api_client-2.13.0 generate.sh
datadog_api_client-2.12.0 generate.sh
datadog_api_client-2.11.0 generate.sh
datadog_api_client-2.10.0 generate.sh
datadog_api_client-2.9.0 generate.sh