1
0
mirror of https://github.com/sharkdp/bat.git synced 2025-09-01 19:02:22 +01:00

Support for ignored-suffix CLI arguments (#1892)

This commit is contained in:
Bojan Đurđević
2021-11-19 11:05:23 -05:00
committed by GitHub
parent 59d4cfb75c
commit d6ed5e6746
10 changed files with 191 additions and 55 deletions

1
tests/examples/test.json.suffix vendored Normal file
View File

@@ -0,0 +1 @@
{"test": "value"}

1
tests/examples/test.json~ vendored Normal file
View File

@@ -0,0 +1 @@
{"test": "value"}

View File

@@ -1225,3 +1225,34 @@ fn grid_for_file_without_newline() {
)
.stderr("");
}
#[test]
fn ignored_suffix_arg() {
bat()
.arg("-f")
.arg("-p")
.arg("test.json~")
.assert()
.success()
.stdout("\u{1b}[38;5;231m{\u{1b}[0m\u{1b}[38;5;208m\"\u{1b}[0m\u{1b}[38;5;208mtest\u{1b}[0m\u{1b}[38;5;208m\"\u{1b}[0m\u{1b}[38;5;231m:\u{1b}[0m\u{1b}[38;5;231m \u{1b}[0m\u{1b}[38;5;186m\"\u{1b}[0m\u{1b}[38;5;186mvalue\u{1b}[0m\u{1b}[38;5;186m\"\u{1b}[0m\u{1b}[38;5;231m}\u{1b}[0m")
.stderr("");
bat()
.arg("-f")
.arg("-p")
.arg("--ignored-suffix=.suffix")
.arg("test.json.suffix")
.assert()
.success()
.stdout("\u{1b}[38;5;231m{\u{1b}[0m\u{1b}[38;5;208m\"\u{1b}[0m\u{1b}[38;5;208mtest\u{1b}[0m\u{1b}[38;5;208m\"\u{1b}[0m\u{1b}[38;5;231m:\u{1b}[0m\u{1b}[38;5;231m \u{1b}[0m\u{1b}[38;5;186m\"\u{1b}[0m\u{1b}[38;5;186mvalue\u{1b}[0m\u{1b}[38;5;186m\"\u{1b}[0m\u{1b}[38;5;231m}\u{1b}[0m")
.stderr("");
bat()
.arg("-f")
.arg("-p")
.arg("test.json.suffix")
.assert()
.success()
.stdout("\u{1b}[38;5;231m{\"test\": \"value\"}\u{1b}[0m")
.stderr("");
}