Add quick-add script for 'todo [name]' pattern

This commit is contained in:
Remora
2026-02-09 14:07:39 +01:00
parent 9470fba60c
commit c98977e3c2

37
scripts/quick-add.sh Executable file
View File

@@ -0,0 +1,37 @@
#!/bin/bash
# Quick add task from "todo [name]" pattern
# Usage: quick-add.sh "Configure Tailscale VPN"
set -euo pipefail
task_name="${1:-}"
if [ -z "$task_name" ]; then
echo "Usage: quick-add.sh <task_name>" >&2
exit 1
fi
API_URL="${TUDUDI_API_URL:-https://todo.dilain.com/api/v1}"
API_KEY="${TUDUDI_API_KEY}"
if [ -z "$API_KEY" ]; then
echo "Error: TUDUDI_API_KEY not set" >&2
exit 1
fi
# Add to inbox (no project)
response=$(curl -s -X POST \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d "{\"name\":\"$task_name\"}" \
"$API_URL/tasks")
task_id=$(echo "$response" | jq -r '.id // empty')
if [ -n "$task_id" ]; then
echo "✅ Added to Tududi inbox: $task_name"
else
echo "⚠️ Failed to add task"
echo "$response" | jq .
exit 1
fi