#!/usr/bin/env bash
# Usage: ghe-config
# Emulates the remote GitHub ghe-config secrets.manage command. Tests use this
# to assert that the command was executed.
set -e

if [ "$1" = "--true" ]; then
  shift
  [[ $($0 "$@") = true ]] && exit 0 || exit 1
fi

if [[ "$1" =~ secrets\..+ ]]; then
  CONFIG="$GHE_REMOTE_DATA_USER_DIR/common/secrets.conf"
else
  CONFIG="$GHE_REMOTE_DATA_USER_DIR/common/github.conf"
fi

git config -f $CONFIG "$@"
