aboutsummaryrefslogtreecommitdiffstats
path: root/agents/todo/tools.sh
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2024-11-16 11:09:40 +0800
committerGitHub <noreply@github.com>2024-11-16 11:09:40 +0800
commit86aa9106090a0219bac30bc12f5a5bd91949afd9 (patch)
tree69aef8c03242c67480c4edfe42a2cbf4c785b466 /agents/todo/tools.sh
parent6d30c22b82a5ac1a5775d8137c3b08a581770273 (diff)
downloadllm-functions-docker-86aa9106090a0219bac30bc12f5a5bd91949afd9.tar.gz
refactor: improve bash code (#125)
* refactor: extract guard_path to utils/guard_path.sh * add utils/guard_operation.sh
Diffstat (limited to 'agents/todo/tools.sh')
-rwxr-xr-xagents/todo/tools.sh10
1 files changed, 3 insertions, 7 deletions
diff --git a/agents/todo/tools.sh b/agents/todo/tools.sh
index 6d31f64..48efa29 100755
--- a/agents/todo/tools.sh
+++ b/agents/todo/tools.sh
@@ -1,6 +1,8 @@
#!/usr/bin/env bash
set -e
+ROOT_DIR="${LLM_ROOT_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)}"
+
# @env LLM_OUTPUT=/dev/stdout The output path
# @cmd Add a new todo item
@@ -65,13 +67,7 @@ list_todos() {
clear_todos() {
todos_file="$(_get_todos_file)"
if [[ -f "$todos_file" ]]; then
- if [ -t 1 ]; then
- read -r -p "Clean the entire todo list? [Y/n] " ans
- if [[ "$ans" == "N" || "$ans" == "n" ]]; then
- echo "Aborted!"
- exit 1
- fi
- fi
+ "$ROOT_DIR/utils/guard_operation.sh" "Clean the entire todo list?"
rm -rf "$todos_file"
echo "Successfully cleaned the entire todo list" >> "$LLM_OUTPUT"
else