Skip to content
Myr

fix: allow hyphen-leading --format templates

Before adoption: this commit came in with the history the project adopted, so no landing records it.

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 #2126.

authored by Jason Wang · committed by Thayne McCombs · parent bb80489 · Browse files · 3 files+14 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

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

Diff stats

3 files+14 added−1 removed

  • tests:+11 added−0 removed
  • other:+3 added−1 removed

3 files+14 added−1 removed

modified:src/cli.rs+2 added-1 removed
480 unmodified lines
481 #[arg(482 long,483 value_name = "fmt",484 help = "Print results according to template",485 conflicts_with = "list_details"485 conflicts_with = "list_details",486 allow_hyphen_values = true487 )]488 pub format: Option<String>,489490 #[command(flatten)]
482 unmodified lines
modified:tests/tests.rs+11 added
1753 unmodified lines
1754 parent=one/two1755 parent=one/two/three1756 parent=one/two/three",1757 );17581759 // Templates may start with '-' (e.g. markdown list items); see #2126.1760 te.assert_output(1761 &["foo", "--format", "- {/.}", "--path-separator=/"],1762 "- a1763 - b1764 - C1765 - c1766 - d1767 - directory_foo",1768 );1769}17701771/// Shell script execution (--exec)1772#[test]
1117 unmodified lines
modified:CHANGELOG.md+1 added
2 unmodified lines
3## Features4-56## Bugfixes7- Accept `--format` templates that start with `-` when passed as a separate argument, see #2126 (@vulragrag-star)8- Don't incorrectly escape newlines in error messages, see #21049- Restore jemalloc as default allocator on supported systems1011# 10.5.0
867 unmodified lines