Skip to content

fix(recipe): refuse a typed answer git would read as an option - #41

Merged
dpologdvinity merged 2 commits into
mainfrom
fix/recipe-dash-answers
Nov 13, 2026
Merged

dpologdvinity merged 2 commits into
mainfrom
fix/recipe-dash-answers

Conversation

@dpologdvinity

Copy link
Copy Markdown
Owner

A typed answer passed alone as an argument reached git as an option when it started with a dash. For example, "Rename a branch" with the new name --force ran git branch -m main --force.

  • internal/recipe: when recipes load, each text question that a step passes alone ("{{.x}}") before --, and not as the value of -m, -L, --path or -c, is marked NoLeadingDash.
  • internal/ui: the wizard refuses an answer for those questions that starts with -, word by word for split answers, and asks again. Commit messages and other option values may still start with a dash.
  • Tests: the real recipes are checked for which questions get marked, checkText gets a unit test, and an end-to-end test renames a branch. That test fails without the fix.
  • Docs: CONTRIBUTING used to tell authors to put -- before branch names, which no recipe did. It now describes this check. ARCHITECTURE has a matching line. Separately, the README now says about 2,700 flags (rows starting with -), not 3,500.

Checks run locally: gofmt, go vet, go test ./..., golangci-lint (0 issues), node --test npm/lib.test.js, typos.

The 3,500 figure counted every row of the docs tables, including arguments, subcommands and
environment variables. Rows for flags (starting with -) number 2,739.
A text answer passed alone as an argument, such as the new name in
"git branch -m <old> <name>", reached git as an option when it started
with a dash: "--force" ran as a flag instead of a name. Recipes now mark
such questions at load time (not after "--" and not as the value of
-m, -L, --path or -c), and the wizard refuses an answer for them that
starts with "-". Commit messages and other option values may still
start with a dash.
@dpologdvinity
dpologdvinity merged commit 8845b8e into main Nov 13, 2026
11 checks passed
@dpologdvinity
dpologdvinity deleted the fix/recipe-dash-answers branch November 13, 2026 02:59
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