Read comment content from stdin when using dash

Merged
RO
4mo ago
+178-104

Summary

Fix comment creation and updates so using - reads the comment body from stdin instead of posting a literal dash. This supports heredoc/pipe workflows and prevents silent wrong-comment posts.

Relationship to #414

#414 is merged. This PR is now rebased onto main and complements #414: #414 covers implicit piped stdin when comment creation omits positional content; this PR covers the explicit - stdin convention and also applies it to comment updates.

Live verification

Tested against the Rob Zolkos account in the Verdant Coffee Roasters project,
Fusilli todolist, using a locally built branch with #414 and this PR.

  • printf ... | basecamp comment <todo_id> - created a comment with the piped content, not a literal -.
  • printf ... | basecamp comments update <comment_id> - updated the comment with the piped content.
  • printf ... | basecamp comments create <todo_id> still works for #414's implicit stdin path.
  • printf ... | basecamp comment <todo_id> - --edit fails fast with cannot combine --edit and positional content.
  • Empty stdin for basecamp comments update <comment_id> - fails with <content> required and does not send an API update.

Ref: https://3.basecamp.com/2914079/buckets/46292715/card_tables/cards/9890985489