Skip to content

feat: add --json output flag to all commands#18

Open
redwing509 wants to merge 1 commit intoApexOpsStudio:mainfrom
redwing509:autoclaw/issue-1-json-output
Open

feat: add --json output flag to all commands#18
redwing509 wants to merge 1 commit intoApexOpsStudio:mainfrom
redwing509:autoclaw/issue-1-json-output

Conversation

@redwing509
Copy link

Summary

Adds --json flag support to all CLI commands (add, list, done) for machine-readable output, enabling scripting and automation use cases.

Changes

  • task.py: Add --json argument to all subparsers, pass through to command functions
  • commands/add.py: Accept json_output param, return structured JSON with success status and task object
  • commands/list.py: Accept json_output param, return tasks array as JSON
  • commands/done.py: Accept json_output param, return completion status as JSON
  • test_task.py: 7 new tests covering JSON output for all commands, empty states, and CLI integration
  • README.md: Document --json flag usage with examples for all commands

JSON Response Format

All JSON responses follow a consistent envelope:

{"success": true, "message": "...", "task": {...}}
{"success": true, "tasks": [...]}

Testing

python -m pytest test_task.py -v

Closes #1

Add --json flag support to add, list, and done commands for
machine-readable output. Each command outputs valid, parseable
JSON when the flag is present.

Changes:
- task.py: Add --json argument to all subparsers
- commands/add.py: json_output param with structured response
- commands/list.py: json_output param with tasks array
- commands/done.py: json_output param with task status
- test_task.py: 7 new tests for JSON output behavior
- README.md: Document --json usage with examples

Closes ApexOpsStudio#1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add --json output format

1 participant