mirror of
https://github.com/sharkdp/bat
synced 2026-07-27 17:41:42 +00:00
Implement --file-name<name> option
- can specify filename to be displayed when printing. - useful for when piping data from STDIN Closes #654
This commit is contained in:
@@ -222,6 +222,7 @@ impl App {
|
||||
.transpose()?
|
||||
.unwrap_or_else(|| vec![LineRange { lower: 0, upper: 0 }]),
|
||||
),
|
||||
filename: self.matches.value_of("file-name").or_else(|| None),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -93,6 +93,18 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
||||
'--highlight-line 40:' highlights lines 40 to the end of the file"
|
||||
),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("file-name")
|
||||
.long("file-name")
|
||||
.takes_value(true)
|
||||
.number_of_values(1)
|
||||
.multiple(true)
|
||||
.value_name("name")
|
||||
.help("Specify the name to display for a file.")
|
||||
.long_help("Specify the name to display for a file. Useful when piping \
|
||||
data to bat from STDIN when bat does not otherwise know \
|
||||
the filename."),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("tabs")
|
||||
.long("tabs")
|
||||
|
||||
Reference in New Issue
Block a user