Skip to content

Commit

Permalink
Document the --override option in CHANGELOG and --help
Browse files Browse the repository at this point in the history
This also enables users to disable language parsing.
Closes #439
Closes #440
  • Loading branch information
Wilfred committed May 16, 2023
1 parent 745253d commit b6895d4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
16 changes: 9 additions & 7 deletions src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)
Expand Down

0 comments on commit b6895d4

Please sign in to comment.