#!/usr/bin/env bash

set -euo pipefail

if [ $# == 0 ] || [ "$1" == '--help' ] || [ "$1" == '-h' ]; then
  cat <<USAGE
Usage: $0 bazel-target...

Disables the given flaky tests by adding the flaky and manual tags.
USAGE

  exit 1
fi

if ! hash buildozer > /dev/null 2>&1; then
  echo buildozer not found!
  echo Installation instructions can be found here: https://github.com/bazelbuild/buildtools/tree/master/buildozer
  echo Alternatively, manually add the flaky and manual tags to the given targets.
  exit 1
fi

buildozer "add tags flaky manual" "$@"
