Add interactive editor flow for quiz add --multiline#43
Merged
Conversation
4 tasks
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>
4ebf77e to
55ef124
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
quiz add -m <name>now opens$EDITOR(defaultvi) 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 withquestion: |/answer: |block scalars, so users no longer hand-edit YAML or rely on stdin piping.Press Enter to edit ... in <editor>...prompt, so the editor only takes over the terminal once the user confirms.tests/fake-editor-write.sh(writes$FAKE_EDITOR_Q/$FAKE_EDITOR_Abased on filename suffix, falling back to$FAKE_EDITOR_CONTENT) and updates the existingadd -mcallers in the Sharness suite to drive the new flow.man/quiz.1andREADME.mdare updated to describe the new behavior.Test plan
make test— full Sharness suite passes locallynpx editorconfig-checker— CI lint passesquiz add -m math/easywith multi-line question/answer produces well-formed YAML that round-trips throughyaml.safe_load🤖 Generated with Claude Code