feat(skill): cover full API — projects, delete, health, all WorkCreate fields
All checks were successful
ci / build-test-push (push) Successful in 1m26s
All checks were successful
ci / build-test-push (push) Successful in 1m26s
This commit is contained in:
27
skill/bin/wq_project_add
Executable file
27
skill/bin/wq_project_add
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
# wq_project_add — create a project
|
||||
# Usage: wq project add <name> [--external-ref <ref>]
|
||||
|
||||
API_URL="${WORK_QUEUE_API_URL:-}"
|
||||
[[ -z "$API_URL" ]] && API_URL=$(cat ~/.config/work_queue_api_url 2>/dev/null || echo "")
|
||||
[[ -z "$API_URL" ]] && { echo "Error: WORK_QUEUE_API_URL not set" >&2; exit 1; }
|
||||
|
||||
name="" external_ref=""
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--external-ref) external_ref="$2"; shift 2;;
|
||||
--) shift; break;;
|
||||
-*) echo "Unknown option: $1" >&2; exit 1;;
|
||||
*) [[ -z "$name" ]] && name="$1" || { echo "Usage: wq project add <name> [--external-ref <ref>]" >&2; exit 1; }; shift;;
|
||||
esac
|
||||
done
|
||||
|
||||
[[ -z "$name" ]] && { echo "Usage: wq project add <name> [--external-ref <ref>]" >&2; exit 1; }
|
||||
|
||||
body="{\"name\":\"$name\"}"
|
||||
[[ -n "$external_ref" ]] && body=$(echo "$body" | jq ".external_ref=\"$external_ref\"")
|
||||
|
||||
curl -sf -X POST "$API_URL/projects" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$body" | jq .
|
||||
Reference in New Issue
Block a user