diff --git a/CHANGELOG.md b/CHANGELOG.md index 823fa25b55..e686cfac2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,13 @@ Fixed an issue where file extensions of the form `*.foo.bar` (e.g. `*.cmake.in`) were ignored. -Removed the `--language` option. +Added an option `--override` which overrides language detection based, +on a glob, e.g. `--override='*.js:javascript jsx'. See `--help` for +full documentation and more examples. + +Removed the `--language` option. This option was confusing (it took a +file extension rather than a language name) and not very useful +(it overrode language detection for all files together). ### Parsing diff --git a/src/options.rs b/src/options.rs index c50cdb993d..3aad52ee9c 100644 --- a/src/options.rs +++ b/src/options.rs @@ -212,21 +212,23 @@ inline: A single column display, closer to traditional diff display.") .arg( Arg::new("override").long("override") .value_name("GLOB:NAME") - .help("Associate this glob pattern with this language, overriding normal language detection. + .help(concat!("Associate this glob pattern with this language, overriding normal language detection. For example: ---override='*.c:C++' - -This argument may be given more than once. +$ ", env!("CARGO_BIN_NAME"), " --override='*.c:C++' old.c new.c Language names are matched case insensitively. Overrides may also specify the language \"text\" to treat a file as plain text. ---override='CustomFile:json' --override='*.c:text' +This argument may be given more than once. For example: + +$ ", env!("CARGO_BIN_NAME"), " --override='CustomFile:json' --override='*.c:text' old.c new.c To configure multiple overrides using environment variables, difftastic also accepts DFT_OVERRIDE_1 up to DFT_OVERRIDE_9. -DFT_OVERRIDE='CustomFile:json' DFT_OVERRIDE_1='*.c:text' DFT_OVERRIDE_2='*.js:javascript jsx' +$ export DFT_OVERRIDE='CustomFile:json' +$ export DFT_OVERRIDE_1='*.c:text' +$ export DFT_OVERRIDE_2='*.js:javascript jsx' -When multiple overrides are specified, the first matching override wins.") +When multiple overrides are specified, the first matching override wins.")) .env("DFT_OVERRIDE") .multiple_occurrences(true) )