Add quick-add script for 'todo [name]' pattern
This commit is contained in:
37
scripts/quick-add.sh
Executable file
37
scripts/quick-add.sh
Executable 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
|
||||
Reference in New Issue
Block a user