#!/usr/bin/env bash

set -euo pipefail

ROOT_DIR="$(cd "$(dirname "$0")" && pwd)"
USER_NAME="${1:-}"

[[ -n "$USER_NAME" ]] || {
  printf 'usage: rho-reset <user>\n' >&2
  exit 1
}

TARGET="$ROOT_DIR/users/$USER_NAME"

if [[ ! -e "$TARGET" ]]; then
  printf 'no state found for %s\n' "$USER_NAME"
  exit 0
fi

rm -rf "$TARGET"
printf 'reset %s\n' "$USER_NAME"
