Skip to content

feat(forms): add question management and watch commands#274

Closed
alexknowshtml wants to merge 1 commit intosteipete:mainfrom
alexknowshtml:feature/forms-management
Closed

feat(forms): add question management and watch commands#274
alexknowshtml wants to merge 1 commit intosteipete:mainfrom
alexknowshtml:feature/forms-management

Conversation

@alexknowshtml
Copy link
Copy Markdown
Contributor

Summary

Extends the forms command group (added in v0.11.0) with full question management and response watch capabilities, covering the remaining Google Forms API surface.

New Commands

Question management (via forms.batchUpdate):

  • forms add-question — Add text, paragraph, radio, checkbox, dropdown, scale, date, or time questions with --type, --option, --required, --index, and type-specific flags
  • forms update — Modify form title, description, or quiz mode after creation
  • forms delete-question — Remove a question by index
  • forms move-question — Reorder questions

Response watches (push notifications):

  • forms watch create — Subscribe to response notifications via Cloud Pub/Sub
  • forms watch list — List active watches
  • forms watch delete — Remove a watch
  • forms watch renew — Extend a watch (7-day expiry)

Usage Examples

# Add a required paragraph question
gog forms add-question <formId> --title "Describe the issue" --type paragraph --required

# Add a multiple choice question
gog forms add-question <formId> --title "Category" --type radio \
  -o "Bug report" -o "Feature request" -o "Other"

# Add a linear scale
gog forms add-question <formId> --title "How satisfied are you?" --type scale \
  --scale-low 1 --scale-high 10 --scale-low-label "Not at all" --scale-high-label "Very"

# Update form metadata
gog forms update <formId> --title "New Title" --description "Updated description"

# Enable quiz mode
gog forms update <formId> --quiz true

# Delete question at index 2
gog forms delete-question <formId> 2

# Reorder: move question from position 3 to position 0
gog forms move-question <formId> 3 0

# Watch for new responses
gog forms watch create <formId> --topic "projects/my-project/topics/my-topic"
gog forms watch list <formId>
gog forms watch renew <formId> <watchId>

Implementation Notes

  • All commands follow existing patterns: --json/--plain output, --dry-run support, --force for destructive ops
  • Uses ForceSendFields on Location.Index to correctly handle index 0 (Go zero-value)
  • add-question with default --index=-1 fetches current form to determine append position
  • Question type flags are scoped (scale flags only relevant for --type scale, etc.)

Files Changed

  • internal/cmd/forms.go — Wired 6 new subcommands into FormsCmd struct
  • internal/cmd/forms_modify.go — Question CRUD + form update commands (426 lines)
  • internal/cmd/forms_watch.go — Watch lifecycle commands (241 lines)

Test Plan

  • Existing forms tests pass (TestExecute_FormsGet_Text, TestExecute_FormsResponsesList_JSON, etc.)
  • go build ./... compiles cleanly
  • All 8 new commands show in gog forms --help
  • Smoke tested add-question against a live form (6 questions of various types)
  • Smoke tested update to modify form description
  • Unit tests for new commands (happy to add if desired)

@alexknowshtml alexknowshtml force-pushed the feature/forms-management branch 2 times, most recently from 88bd383 to d514f57 Compare February 15, 2026 18:24
New commands: add-question, delete-question, move-question, update, and
watch create/list/delete/renew. Covers the full Google Forms API surface
for form modification via batchUpdate and response watches.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@alexknowshtml alexknowshtml force-pushed the feature/forms-management branch from d514f57 to 757ac5e Compare February 15, 2026 18:27
@steipete
Copy link
Copy Markdown
Owner

steipete commented Mar 8, 2026

Landed directly on main after deep review and fixup.

PR head repo is no longer available, so the rebased branch could not be pushed back for a normal PR merge.

  • Gate: make ci
  • Land commits: 1de2305, 5c3eaa4, 2d38040

Key fixups:

  • added delete-question validation + confirmation guardrails
  • added focused tests for question building, add/delete flows, and watch commands
  • updated README and CHANGELOG

Thanks @alexknowshtml!

@steipete
Copy link
Copy Markdown
Owner

steipete commented Mar 8, 2026

Closed after direct landing on main; see landed commits and tests above.

@steipete steipete closed this Mar 8, 2026
klodr pushed a commit to klodr/gogcli that referenced this pull request Apr 22, 2026
klodr pushed a commit to klodr/gogcli that referenced this pull request Apr 22, 2026
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.

2 participants