Commit Graph

11414 Commits (cadceb20b08b2d9335a86d494fb903eee6f06c79)
 

Author SHA1 Message Date
Wilfred Hughes cadceb20b0 Show whole file names too with --list-languages 2022-12-19 09:33:53 +07:00
Wilfred Hughes a21327ab13 Factor out a constant for language file associations 2022-12-19 09:23:46 +07:00
Wilfred Hughes fda897b816 Don't parse rebar.lock files as Erlang
The Erlang parser doesn't support this syntax apparently:
https://github.com/WhatsApp/tree-sitter-erlang/issues/3
2022-12-19 01:00:56 +07:00
Wilfred Hughes d169c7f96c Update version in Cargo.lock 2022-12-19 01:00:48 +07:00
Wilfred Hughes 723e3dbd0e Roll version 2022-12-19 00:20:42 +07:00
Wilfred Hughes e0fcf2b84b Add a --check-only flag
Fixes #386
2022-12-18 23:55:22 +07:00
Wilfred Hughes abd5e07654 Add a has_syntactic_changes field 2022-12-18 23:21:36 +07:00
Wilfred Hughes b34cdabfdc Prefer has_changes to has_same for clarity 2022-12-18 23:17:05 +07:00
Wilfred Hughes a2f22cb17c Only set the exit code if --exit-code is set
This is important for usage with git log, which terminates on non-zero
exit codes.
2022-12-18 23:11:18 +07:00
Wilfred Hughes b7cfff3f27 Silence some clippy lints 2022-12-18 00:33:27 +07:00
Wilfred Hughes 6a46237bb0 Set the exit code when changes are found
Closes #285
2022-12-18 00:28:54 +07:00
Wilfred Hughes 7dd6bbd609 Implement Default on DisplayOptions 2022-12-17 23:49:18 +07:00
Wilfred Hughes aa067e636b Don't bother storing bytes of binary files 2022-12-17 23:44:48 +07:00
Wilfred Hughes 4b2e601de1 Store hunks in Summary 2022-12-17 23:42:20 +07:00
Wilfred Hughes 2cf27ec7cd Display paths relative to cwd
Fixes #444
2022-12-16 10:08:38 +07:00
Wilfred Hughes afc78e976d Document Erlang support and add test
Fixes #394
2022-12-15 23:30:45 +07:00
Wilfred Hughes bb2ae868d7 Add basic Erlang syntax highlighting
Improves #394
2022-12-15 23:20:37 +07:00
Wilfred Hughes 583c55964b Fix typo 2022-12-15 09:27:13 +07:00
Wilfred Hughes 75299f79fd Configure erlang delimiters 2022-12-14 23:58:15 +07:00
Wilfred Hughes e6cec41e23 Add basic Erlang support
Add tree-sitter and configure language detection. Helps with #394

Co-authored-by: Benedikt Reinartz <filmor@gmail.com>
2022-12-14 23:51:26 +07:00
Wilfred Hughes db3a1db04e Add 'vendor/tree-sitter-erlang/' from commit 'a8b8b0e16c4f5552f5e85af3dec976a5d16af8b9'
git-subtree-dir: vendor/tree-sitter-erlang
git-subtree-mainline: c5985c88b2
git-subtree-split: a8b8b0e16c
2022-12-14 23:35:23 +07:00
Wilfred Hughes c5985c88b2 Allow null bytes in UTF16 input files 2022-12-13 09:38:24 +07:00
Wilfred Hughes 7b31be8adb Improve binary file detection heuristics
Fixes #433
2022-12-08 10:29:35 +07:00
Wilfred Hughes 84a968cdbb cargo fmt 2022-12-08 10:28:24 +07:00
Wilfred Hughes 4da26f6459 Derive equality and debug on ProbableFileKind 2022-12-08 10:04:25 +07:00
Wilfred Hughes 554fb18b7c Fix interleaved output when diffing directories
Fixes #437
2022-12-08 09:58:19 +07:00
rhirano0715 436edb2ab4 Only add colour to the first hunk header
This helps skimming the results when multiple files are changed with
multiple hunks. It makes the file changing more prominent than just
going from e.g. 5/5 to 1/10.

Fixes #400

Acked-by: Wilfred Hughes <me@wilfred.me.uk>
2022-12-01 09:38:36 +07:00
Wilfred Hughes 0eb66bebfd
Merge pull request #431 from michel-slm/binstall
Add `cargo binstall` metadata
2022-11-23 14:59:16 +07:00
Michel Alexandre Salim 08041e5793
Add `cargo binstall` metadata
Right now `cargo binstall` cannot find the pre-compiled `difftastic`
assets:

```
~
❯ cargo binstall difftastic
 INFO resolve: Resolving package: 'difftastic'
 WARN resolve: The package will be installed from source (with cargo)
Do you wish to continue? yes/[no]
? no
 WARN Installation cancelled

~ took 18s
❯ cargo binstall difftastic --pkg-url="{ repo }/releases/download/{ version }/difft-{ target }.{ archive-format }"
 INFO resolve: Resolving package: 'difftastic'
 WARN resolve: The package will be downloaded from github.com
 INFO resolve: This will install the following binaries:
 INFO resolve:   - difft (difft -> /home/michel/.cargo/bin/difft-v0.38.0)
 INFO resolve: And create (or update) the following symlinks:
 INFO resolve:   - difft (/home/michel/.cargo/bin/difft -> difft-v0.38.0)
Do you wish to continue? yes/[no]
? yes
 INFO install: Installing binaries...
 INFO Done in 9.277840305s
```

Adding this `pkg-url` override to `Cargo.toml` allows `binstall` to find
the pre-compiled archives:

```
~
❯ cargo binstall --manifest-path ~/src/github/Wilfred/difftastic/Cargo.toml difftastic
 INFO resolve: Resolving package: 'difftastic'
 INFO resolve: difftastic v0.38.0 is already installed, use --force to override
 INFO Done in 5.327886ms

~
❯ cargo binstall --manifest-path ~/src/github/Wilfred/difftastic/Cargo.toml difftastic --force
 INFO resolve: Resolving package: 'difftastic'
 WARN resolve: The package will be downloaded from github.com
 INFO resolve: This will install the following binaries:
 INFO resolve:   - difft (difft -> /home/michel/.cargo/bin/difft-v0.38.0)
 INFO resolve: And create (or update) the following symlinks:
 INFO resolve:   - difft (/home/michel/.cargo/bin/difft -> difft-v0.38.0)
Do you wish to continue? yes/[no]
? yes
 INFO install: Installing binaries...
 INFO Done in 5.484314255s
```

Signed-off-by: Michel Alexandre Salim <michel@michel-slm.name>
2022-11-23 14:01:25 +07:00
Wilfred Hughes 8e190677e7 Roll version 2022-11-14 00:30:56 +07:00
Wilfred Hughes 2e7c90c472 Ensure line wrapping uses the same length on both sides
Closes #421
2022-11-13 00:35:06 +07:00
Wilfred Hughes 0603b9fb23 Include LICENSE in crates.io source files
Closes #423
2022-11-13 00:13:47 +07:00
Wilfred Hughes 923989d1a8 clippy fixes 2022-11-03 22:18:56 +07:00
Wilfred Hughes b662a2220b Apply upstream tree_magic_mini patch to fix blank line crash
Fixes #378
2022-10-31 00:54:24 +07:00
Wilfred Hughes 7f7b35441b Ensure that inline display without color has newlines
This was broken in 3147eb8e6a when
newline splitting was made consistent, and
2071517621 only fixed the inline case
when color was enabled.

Fixed #383
2022-10-28 23:42:52 +07:00
Wilfred Hughes 28c3b0ef5d Tweak line number styling to make it more distinct from content
Dim line numbers for unchanged lines, and make changed lines bold (in
addition to the existing red/green colours).

Closes #384
2022-10-28 20:34:36 +07:00
Wilfred Hughes 2a3346e338 Use apply_line_number_color consistently on LHS and RHS
Previously we missed a case on the LHS.
2022-10-28 20:18:17 +07:00
Wilfred Hughes 4d8d2a2f9d Fix a clippy lint 2022-10-28 19:39:44 +07:00
Wilfred Hughes 1d6c7923e3 Replace remaining is_lhs booleans with Side arguments 2022-10-28 19:27:46 +07:00
Wilfred Hughes 7ea4b96a41 Prefer Side over booleans in line number styling 2022-10-28 19:14:06 +07:00
Wilfred Hughes 490787fe28 Factor out line number styling 2022-10-28 19:07:51 +07:00
Wilfred Hughes c152c41691 Document punctuation atoms 2022-10-25 16:12:47 +07:00
Gurjeet Singh cbfc70c0b5 Remove TreeSitterConfig.name from documentation
TreeSitterConfig doesn't seem to have the `name` attribute, anymore.

I discovered this discrepancy while integrating Markdown language parser
in PR #380.
2022-10-24 23:06:20 +07:00
facebook-github-bot a8b8b0e16c Initial commit
fbshipit-source-id: ba4d26ff8ff932e614e343d0c8cac90abf5f2776
2022-10-19 08:51:29 +07:00
Wilfred Hughes b9d44ae65f Treat error nodes as atoms
Fixes #408
2022-10-15 22:50:08 +07:00
Wilfred Hughes 267b413f08 Fix unwanted cursor in screenshot 2022-10-14 22:04:48 +07:00
Wilfred Hughes e91878fb32 0.37 is now released 2022-10-14 16:10:27 +07:00
Wilfred Hughes 6b0009c941 Mention perf improvements from #393 and #395 2022-10-14 13:50:00 +07:00
Wilfred Hughes 02f1cca444 Display stdin CLI arguments as "(stdin)"
This improves display for #389, and makes language detection use
pattern matching on FileArgument rather than comparing literal
strings.
2022-10-14 13:46:30 +07:00
Wilfred Hughes b4ff28c75e Fix side-by-side line length when colour is disabled
Fixes #406

Looks like this was inadvertently broken in #301.
2022-10-14 13:15:17 +07:00