Files
CrazyClaude/utils/guard_operation.sh
Eric Coissac 2f1d437723 Squashed '.claude/llm-functions/' content from commit 616d8d8
git-subtree-dir: .claude/llm-functions
git-subtree-split: 616d8d84c5565fdb66d8782ae5ba56d994bfa82a
2026-03-27 09:14:17 +01:00

17 lines
372 B
Bash
Executable File

#!/usr/bin/env bash
# Guard an operation with a confirmation prompt.
main() {
if [ -t 1 ]; then
confirmation_prompt="${1:-"Are you sure you want to continue?"}"
read -r -p "$confirmation_prompt [Y/n] " ans
if [[ "$ans" == "N" || "$ans" == "n" ]]; then
echo "error: aborted!" 2>&1
exit 1
fi
fi
}
main "$@"