Skip to content

fix: allow hyphen-leading --format templates - #2127

Merged
tmccombs merged 1 commit into
sharkdp:masterfrom
vulragrag-star:fix/format-hyphen-values
Sep 9, 2026
Merged

fix: allow hyphen-leading --format templates#2127
tmccombs merged 1 commit into
sharkdp:masterfrom
vulragrag-star:fix/format-hyphen-values

Conversation

@vulragrag-star

Copy link
Copy Markdown
Contributor

Summary

--format values that start with - were rejected when passed as a separate argument (fd --format "- {/.}"), while the = form worked. Clap treated the value as a new flag. Enable allow_hyphen_values for --format (same treatment as --and) so markdown-list-style templates work as documented.

Fixes #2126

Test plan

  • Added regression in tests/tests.rs for --format "- {/.}"
  • Fork CI green (fmt, clippy, MSRV, multi-target builds)

Notes

AI coding assistance was used to help locate the clap option and draft the patch; I reviewed the change, wrote/adjusted the regression, and verified CI.

Signed-off-by: Jason Wang vulragrag@gmail.com

Clap treated a space-separated --format value that starts with '-' as a
new flag. Enable allow_hyphen_values for --format (same as --and) and
add a regression covering markdown-list-style templates. See sharkdp#2126.

Signed-off-by: Jason Wang <vulragrag@gmail.com>
@tmccombs
tmccombs merged commit b422e5d into sharkdp:master Sep 9, 2026
19 checks passed
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.

[BUG] --format rejects templates starting with - and gives a misleading error suggestion

2 participants