Fluent text input: positional args, short flags, and stdin

Merged
JE
8mo ago
+395-24

Summary

  • todo add accepts positional title, -t shorthand, and stdin (in addition to existing --title)
  • journal write accepts positional content with date/content disambiguation, -c shorthand (in addition to existing --content and stdin/$EDITOR)
  • Flag and positional are mutually exclusive with clear error messages
  • Resolution order: named flag > positional arg > stdin > $EDITOR
# Before
hey todo add --title "Buy milk"
hey journal write --content "Today was great"

# After (flag forms still work)
hey todo add "Buy milk"
hey journal write "Today was great"
hey journal write 2024-01-15 "Retrospective"
echo "Buy milk" | hey todo add

Cross-CLI conventions documented in basecamp/cli@6f99340 (INPUT-CONVENTIONS.md).

Test plan

  • go test ./internal/cmd/ -run TestTodoAdd -v — 6 tests (positional, short flag, long flag, conflict, empty, stdin)
  • go test ./internal/cmd/ -run TestJournalWrite -v — 5 tests (positional content, date+content, short flag, two conflict cases)
  • go test ./internal/cmd/ -run TestSurface -v — surface unchanged
  • make check — full suite passes (go vet + all tests; lint deferred to CI due to local toolchain mismatch)