Skip to content

Commit 31bca27

Browse files
authored
Merge pull request #2064 from adity982/agent/remove-misleading-in-place-aliases
fix(cli): remove misleading in-place aliases
2 parents f8fd420 + e9a92bd commit 31bca27

4 files changed

Lines changed: 14 additions & 10 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ Options:
226226
-F, --output-format <OUTPUT_FORMAT>
227227
Set output format [default: markdown] [possible values: markdown, html, text, json, table, grep, raw, none]
228228
-U, --update
229-
Update the input markdown (aliases: -i, --in-place, --inplace)
229+
Update matching Markdown nodes and write the result to stdout
230230
--unbuffered
231231
Unbuffered output
232232
--list-style <LIST_STYLE>

crates/mq-run/src/cli.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -381,14 +381,8 @@ struct OutputArgs {
381381
#[arg(short = 'F', long, value_enum, default_value_t)]
382382
output_format: OutputFormat,
383383

384-
/// Update the input markdown (aliases: -i, --in-place, --inplace)
385-
#[arg(
386-
short = 'U',
387-
long = "update",
388-
short_alias='i',
389-
aliases=["in-place", "inplace"],
390-
default_value_t = false
391-
)]
384+
/// Update matching Markdown nodes and write the result to stdout
385+
#[arg(short = 'U', long = "update", default_value_t = false)]
392386
update: bool,
393387

394388
/// Unbuffered output

crates/mq-run/tests/integration_tests.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@ fn test_cli_run_with_stdin() -> Result<(), Box<dyn std::error::Error>> {
2828
Ok(())
2929
}
3030

31+
#[rstest]
32+
#[case("-i")]
33+
#[case("--in-place")]
34+
#[case("--inplace")]
35+
fn update_does_not_accept_misleading_in_place_aliases(#[case] alias: &str) {
36+
let mut cmd = cargo::cargo_bin_cmd!("mq");
37+
38+
cmd.arg(alias).arg("self").write_stdin("# Title\n").assert().failure();
39+
}
40+
3141
#[rstest]
3242
#[case::json(
3343
vec!["--unbuffered", "-F", "json", ".code_inline"],

docs/books/src/reference/cli.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Options:
5151
-F, --output-format <OUTPUT_FORMAT>
5252
Set output format [default: markdown] [possible values: markdown, html, text, json, table, grep, raw, none]
5353
-U, --update
54-
Update the input markdown (aliases: -i, --in-place, --inplace)
54+
Update matching Markdown nodes and write the result to stdout
5555
--unbuffered
5656
Unbuffered output
5757
--list-style <LIST_STYLE>

0 commit comments

Comments
 (0)