Skip to content

Commit b6895d4

Browse files
committed
Document the --override option in CHANGELOG and --help
This also enables users to disable language parsing. Closes #439 Closes #440
1 parent 745253d commit b6895d4

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@
55
Fixed an issue where file extensions of the form `*.foo.bar`
66
(e.g. `*.cmake.in`) were ignored.
77

8-
Removed the `--language` option.
8+
Added an option `--override` which overrides language detection based,
9+
on a glob, e.g. `--override='*.js:javascript jsx'. See `--help` for
10+
full documentation and more examples.
11+
12+
Removed the `--language` option. This option was confusing (it took a
13+
file extension rather than a language name) and not very useful
14+
(it overrode language detection for all files together).
915

1016
### Parsing
1117

src/options.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -212,21 +212,23 @@ inline: A single column display, closer to traditional diff display.")
212212
.arg(
213213
Arg::new("override").long("override")
214214
.value_name("GLOB:NAME")
215-
.help("Associate this glob pattern with this language, overriding normal language detection.
215+
.help(concat!("Associate this glob pattern with this language, overriding normal language detection. For example:
216216
217-
--override='*.c:C++'
218-
219-
This argument may be given more than once.
217+
$ ", env!("CARGO_BIN_NAME"), " --override='*.c:C++' old.c new.c
220218
221219
Language names are matched case insensitively. Overrides may also specify the language \"text\" to treat a file as plain text.
222220
223-
--override='CustomFile:json' --override='*.c:text'
221+
This argument may be given more than once. For example:
222+
223+
$ ", env!("CARGO_BIN_NAME"), " --override='CustomFile:json' --override='*.c:text' old.c new.c
224224
225225
To configure multiple overrides using environment variables, difftastic also accepts DFT_OVERRIDE_1 up to DFT_OVERRIDE_9.
226226
227-
DFT_OVERRIDE='CustomFile:json' DFT_OVERRIDE_1='*.c:text' DFT_OVERRIDE_2='*.js:javascript jsx'
227+
$ export DFT_OVERRIDE='CustomFile:json'
228+
$ export DFT_OVERRIDE_1='*.c:text'
229+
$ export DFT_OVERRIDE_2='*.js:javascript jsx'
228230
229-
When multiple overrides are specified, the first matching override wins.")
231+
When multiple overrides are specified, the first matching override wins."))
230232
.env("DFT_OVERRIDE")
231233
.multiple_occurrences(true)
232234
)

0 commit comments

Comments
 (0)