diff --git a/README.md b/README.md index 96058de5..e0367e21 100644 --- a/README.md +++ b/README.md @@ -500,11 +500,11 @@ Example configuration file: # Use italic text on the terminal (not supported on all terminals) --italic-text=always -# Use C++ syntax (instead of C) for .h header files ---map-syntax h:cpp +# Use C++ syntax for .ino files +--map-syntax "*.ino:C++" -# Use "gitignore" highlighting for ".ignore" files ---map-syntax .ignore:.gitignore +# Use ".gitignore"-style highlighting for ".ignore" files +--map-syntax ".ignore:Git Ignore" ``` ## Using `bat` on Windows diff --git a/assets/manual/bat.1.in b/assets/manual/bat.1.in index b5761cfb..6345bde5 100644 --- a/assets/manual/bat.1.in +++ b/assets/manual/bat.1.in @@ -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 the '\-\-paging' option. Example: '\-\-pager "less \fB\-RF\fR"'. .HP -\fB\-m\fR, \fB\-\-map\-syntax\fR ... +\fB\-m\fR, \fB\-\-map\-syntax\fR ... .IP -Map a file extension or file name to an existing syntax (specified by a file extension -or file name). For example, to highlight *.build files with the Python syntax, use '\-m -build:py'. To highlight files named '.myignore' with the Git Ignore syntax, use '\-m -\&.myignore:gitignore'. +Map a glob pattern to an existing syntax name. The glob pattern is matched on the full +path and the filename. For example, to highlight *.build files with the Python syntax, +use -m '*.build:Python'. To highlight files named '.myignore' with the Git Ignore +syntax, use -m '.myignore:Git Ignore'. .HP \fB\-\-theme\fR .IP diff --git a/doc/README-ja.md b/doc/README-ja.md index a018e07c..08f62260 100644 --- a/doc/README-ja.md +++ b/doc/README-ja.md @@ -500,11 +500,11 @@ export BAT_CONFIG_PATH="/path/to/bat.conf" # Use italic text on the terminal (not supported on all terminals) --italic-text=always -# Use C++ syntax (instead of C) for .h header files ---map-syntax h:cpp +# Use C++ syntax for .ino files +--map-syntax "*.ino:C++" -# Use "gitignore" highlighting for ".ignore" files ---map-syntax .ignore:.gitignore +# Use ".gitignore"-style highlighting for ".ignore" files +--map-syntax ".ignore:Git Ignore" ``` ## Windows での `bat` の利用 diff --git a/doc/README-ko.md b/doc/README-ko.md index c67c037d..edc71906 100644 --- a/doc/README-ko.md +++ b/doc/README-ko.md @@ -452,11 +452,11 @@ export BAT_CONFIG_PATH="/path/to/bat.conf" # Use italic text on the terminal (not supported on all terminals) --italic-text=always -# Use C++ syntax (instead of C) for .h header files ---map-syntax h:cpp +# Use C++ syntax for .ino files +--map-syntax "*.ino:C++" -# Use "gitignore" highlighting for ".ignore" files ---map-syntax .ignore:.gitignore +# Use ".gitignore"-style highlighting for ".ignore" files +--map-syntax ".ignore:Git Ignore" ``` ## Windows에서 사용하기 diff --git a/src/bin/bat/app.rs b/src/bin/bat/app.rs index 3ab22f52..ae889453 100644 --- a/src/bin/bat/app.rs +++ b/src/bin/bat/app.rs @@ -111,7 +111,7 @@ impl App { let parts: Vec<_> = from_to.split(':').collect(); 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 ':'. For example: '*.cpp:C++'.".into()); } syntax_mapping.insert(parts[0], MappingTarget::MapTo(parts[1]))?; diff --git a/src/bin/bat/clap_app.rs b/src/bin/bat/clap_app.rs index f234085a..0016a345 100644 --- a/src/bin/bat/clap_app.rs +++ b/src/bin/bat/clap_app.rs @@ -248,13 +248,13 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> { .multiple(true) .takes_value(true) .number_of_values(1) - .value_name("from:to") - .help("Map a file extension or name to an existing syntax.") + .value_name("glob:syntax") + .help("Use the specified syntax for files matching the glob pattern ('*.cpp:C++').") .long_help( - "Map a file extension or file name to an existing syntax (specified by a file \ - extension or file name). For example, to highlight *.build files with the \ - Python syntax, use '-m build:py'. To highlight files named '.myignore' with \ - the Git Ignore syntax, use '-m .myignore:gitignore'.", + "Map a glob pattern to an existing syntax name. The glob pattern is matched \ + on the full path and the filename. For example, to highlight *.build files \ + with the Python syntax, use -m '*.build:Python'. To highlight files named \ + '.myignore' with the Git Ignore syntax, use -m '.myignore:Git Ignore'.", ) .takes_value(true), ) @@ -281,7 +281,7 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> { .arg( Arg::with_name("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 // example at https://docs.rs/clap/2.32.0/clap/struct.Arg.html#method.overrides_with .use_delimiter(false)