Skip to content

Add interactive editor flow for quiz add --multiline#43

Merged
rikuson merged 3 commits into
masterfrom
add-multiline-editor
May 10, 2026
Merged

Add interactive editor flow for quiz add --multiline#43
rikuson merged 3 commits into
masterfrom
add-multiline-editor

Conversation

@rikuson

@rikuson rikuson commented May 10, 2026

Copy link
Copy Markdown
Owner

Summary

  • quiz add -m <name> now opens $EDITOR (default vi) twice — first on an empty buffer for the question body, then on an empty buffer for the answer body — and assembles the two buffers into a YAML file with question: | / answer: | block scalars, so users no longer hand-edit YAML or rely on stdin piping.
  • Each editor invocation is gated by a Press Enter to edit ... in <editor>... prompt, so the editor only takes over the terminal once the user confirms.
  • Adds tests/fake-editor-write.sh (writes $FAKE_EDITOR_Q / $FAKE_EDITOR_A based on filename suffix, falling back to $FAKE_EDITOR_CONTENT) and updates the existing add -m callers in the Sharness suite to drive the new flow. man/quiz.1 and README.md are updated to describe the new behavior.

Test plan

  • make test — full Sharness suite passes locally
  • npx editorconfig-checker — CI lint passes
  • Manual smoke test: quiz add -m math/easy with multi-line question/answer produces well-formed YAML that round-trips through yaml.safe_load

🤖 Generated with Claude Code

rikuson and others added 3 commits May 11, 2026 00:54
Replace the stdin-fed multiline path with a tempfile prefilled with
`question: |` / `answer: |` opened in $EDITOR, so users can author
multi-line questions and answers in their editor.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Open $EDITOR twice — first on an empty buffer for the question body,
then on an empty buffer for the answer body — and assemble the two
buffers into a YAML file with `question: |` / `answer: |` block
scalars. Users no longer hand-edit YAML.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Print a "Press Enter to edit..." prompt and read a line before
each editor invocation, so users have time to read the message
before $EDITOR takes over the terminal.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@rikuson rikuson force-pushed the add-multiline-editor branch from 4ebf77e to 55ef124 Compare May 10, 2026 15:54
@rikuson rikuson merged commit 2ed5ae5 into master May 10, 2026
3 checks passed
@rikuson rikuson deleted the add-multiline-editor branch May 10, 2026 15:56
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.

1 participant