aboutsummaryrefslogtreecommitdiffstats
path: root/bots/todo-sh/tools.sh
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2024-06-22 06:52:45 +0800
committerGitHub <noreply@github.com>2024-06-22 06:52:45 +0800
commitadfb7c2b49ba4ba691e89683afa700eabbb3388c (patch)
tree730829361b85a15e5dd0d323ae185c00068ce053 /bots/todo-sh/tools.sh
parenta799428b397ac7789a91cf94a9c408ee8a2dd6e2 (diff)
downloadllm-functions-docker-adfb7c2b49ba4ba691e89683afa700eabbb3388c.tar.gz
refactor: rename bot to agent (#44)
Diffstat (limited to 'bots/todo-sh/tools.sh')
-rwxr-xr-xbots/todo-sh/tools.sh67
1 files changed, 0 insertions, 67 deletions
diff --git a/bots/todo-sh/tools.sh b/bots/todo-sh/tools.sh
deleted file mode 100755
index e387d75..0000000
--- a/bots/todo-sh/tools.sh
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/usr/bin/env bash
-set -e
-
-# @cmd Add a new todo item
-# @option --desc! The task description
-add_todo() {
- todos_file="$(_get_todos_file)"
- if [[ -f "$todos_file" ]]; then
- num="$(cat "$todos_file" | jq '[.[].id] | max + 1')"
- data="$(cat "$todos_file")"
- else
- num=1
- data="[]"
- fi
- echo "$data" | \
- jq --arg new_id $num \
- --arg new_desc "$argc_desc" \
- '. += [{"id": $new_id | tonumber, "desc": $new_desc}]' \
- > "$todos_file"
- echo "Successfully added todo id=$num"
-}
-
-# @cmd Delete an existing todo item
-# @option --id! <INT> The task id
-del_todo() {
- todos_file="$(_get_todos_file)"
- if [[ -f "$todos_file" ]]; then
- data="$(cat "$todos_file")"
- echo "$data" | \
- jq --arg id $argc_id '[.[] | select(.id != ($id | tonumber))]' \
- > "$todos_file"
- echo "Successfully deleted todo id=$argc_id"
- else
- echo "Empty todo list"
- fi
-}
-
-# @cmd Display the current todo list in json format.
-list_todos() {
- todos_file="$(_get_todos_file)"
- if [[ -f "$todos_file" ]]; then
- cat "$todos_file"
- else
- echo '[]'
- fi
-}
-
-# @cmd Delete the entire todo list.
-clear_todos() {
- todos_file="$(_get_todos_file)"
- if [[ -f "$todos_file" ]]; then
- rm -rf "$todos_file"
- fi
- echo "Successfully deleted entry todo list"
-}
-
-_argc_before() {
- todos_file="$(_get_todos_file)"
- mkdir -p "$(dirname "$todos_file")"
-}
-
-_get_todos_file() {
- echo "${LLM_BOT_CACHE_DIR:-/tmp}/todos.json"
-}
-
-# See more details at https://github.com/sigoden/argc
-eval "$(argc --argc-eval "$0" "$@")"