Update documentation

This commit is contained in:
sharkdp 2020-03-22 10:37:18 +01:00 committed by David Peter
parent 57aed07814
commit 978def2d40
6 changed files with 25 additions and 25 deletions

View file

@ -500,11 +500,11 @@ Example configuration file:
# Use italic text on the terminal (not supported on all terminals) # Use italic text on the terminal (not supported on all terminals)
--italic-text=always --italic-text=always
# Use C++ syntax (instead of C) for .h header files # Use C++ syntax for .ino files
--map-syntax h:cpp --map-syntax "*.ino:C++"
# Use "gitignore" highlighting for ".ignore" files # Use ".gitignore"-style highlighting for ".ignore" files
--map-syntax .ignore:.gitignore --map-syntax ".ignore:Git Ignore"
``` ```
## Using `bat` on Windows ## Using `bat` on Windows

View file

@ -100,12 +100,12 @@ Determine which pager is used. This option will overwrite the PAGER and BAT_PAGE
environment variables. The default pager is 'less'. To disable the pager completely, use environment variables. The default pager is 'less'. To disable the pager completely, use
the '\-\-paging' option. Example: '\-\-pager "less \fB\-RF\fR"'. the '\-\-paging' option. Example: '\-\-pager "less \fB\-RF\fR"'.
.HP .HP
\fB\-m\fR, \fB\-\-map\-syntax\fR <from:to>... \fB\-m\fR, \fB\-\-map\-syntax\fR <glob-pattern:syntax-name>...
.IP .IP
Map a file extension or file name to an existing syntax (specified by a file extension Map a glob pattern to an existing syntax name. The glob pattern is matched on the full
or file name). For example, to highlight *.build files with the Python syntax, use '\-m path and the filename. For example, to highlight *.build files with the Python syntax,
build:py'. To highlight files named '.myignore' with the Git Ignore syntax, use '\-m use -m '*.build:Python'. To highlight files named '.myignore' with the Git Ignore
\&.myignore:gitignore'. syntax, use -m '.myignore:Git Ignore'.
.HP .HP
\fB\-\-theme\fR <theme> \fB\-\-theme\fR <theme>
.IP .IP

View file

@ -500,11 +500,11 @@ export BAT_CONFIG_PATH="/path/to/bat.conf"
# Use italic text on the terminal (not supported on all terminals) # Use italic text on the terminal (not supported on all terminals)
--italic-text=always --italic-text=always
# Use C++ syntax (instead of C) for .h header files # Use C++ syntax for .ino files
--map-syntax h:cpp --map-syntax "*.ino:C++"
# Use "gitignore" highlighting for ".ignore" files # Use ".gitignore"-style highlighting for ".ignore" files
--map-syntax .ignore:.gitignore --map-syntax ".ignore:Git Ignore"
``` ```
## Windows での `bat` の利用 ## Windows での `bat` の利用

View file

@ -452,11 +452,11 @@ export BAT_CONFIG_PATH="/path/to/bat.conf"
# Use italic text on the terminal (not supported on all terminals) # Use italic text on the terminal (not supported on all terminals)
--italic-text=always --italic-text=always
# Use C++ syntax (instead of C) for .h header files # Use C++ syntax for .ino files
--map-syntax h:cpp --map-syntax "*.ino:C++"
# Use "gitignore" highlighting for ".ignore" files # Use ".gitignore"-style highlighting for ".ignore" files
--map-syntax .ignore:.gitignore --map-syntax ".ignore:Git Ignore"
``` ```
## Windows에서 사용하기 ## Windows에서 사용하기

View file

@ -111,7 +111,7 @@ impl App {
let parts: Vec<_> = from_to.split(':').collect(); let parts: Vec<_> = from_to.split(':').collect();
if parts.len() != 2 { if parts.len() != 2 {
return Err("Invalid syntax mapping. The format of the -m/--map-syntax option is 'from:to'.".into()); return Err("Invalid syntax mapping. The format of the -m/--map-syntax option is '<glob-pattern>:<syntax-name>'. For example: '*.cpp:C++'.".into());
} }
syntax_mapping.insert(parts[0], MappingTarget::MapTo(parts[1]))?; syntax_mapping.insert(parts[0], MappingTarget::MapTo(parts[1]))?;

View file

@ -248,13 +248,13 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
.multiple(true) .multiple(true)
.takes_value(true) .takes_value(true)
.number_of_values(1) .number_of_values(1)
.value_name("from:to") .value_name("glob:syntax")
.help("Map a file extension or name to an existing syntax.") .help("Use the specified syntax for files matching the glob pattern ('*.cpp:C++').")
.long_help( .long_help(
"Map a file extension or file name to an existing syntax (specified by a file \ "Map a glob pattern to an existing syntax name. The glob pattern is matched \
extension or file name). For example, to highlight *.build files with the \ on the full path and the filename. For example, to highlight *.build files \
Python syntax, use '-m build:py'. To highlight files named '.myignore' with \ with the Python syntax, use -m '*.build:Python'. To highlight files named \
the Git Ignore syntax, use '-m .myignore:gitignore'.", '.myignore' with the Git Ignore syntax, use -m '.myignore:Git Ignore'.",
) )
.takes_value(true), .takes_value(true),
) )
@ -281,7 +281,7 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
.arg( .arg(
Arg::with_name("style") Arg::with_name("style")
.long("style") .long("style")
.value_name("style-components") .value_name("components")
// Need to turn this off for overrides_with to work as we want. See the bottom most // Need to turn this off for overrides_with to work as we want. See the bottom most
// example at https://docs.rs/clap/2.32.0/clap/struct.Arg.html#method.overrides_with // example at https://docs.rs/clap/2.32.0/clap/struct.Arg.html#method.overrides_with
.use_delimiter(false) .use_delimiter(false)