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:
1
tests/examples/test.json.suffix
vendored
Normal file
1
tests/examples/test.json.suffix
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"test": "value"}
|
1
tests/examples/test.json~
vendored
Normal file
1
tests/examples/test.json~
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"test": "value"}
|
@@ -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("");
|
||||
}
|
||||
|
Reference in New Issue
Block a user