Commit Graph

642 Commits

Author SHA1 Message Date
Mohamed Abdelnour
aa74d19940 Refactor "Use matches macro" 2021-05-27 12:05:07 +02:00
Mohamed Abdelnour
425a0f90e9 Use the functional update syntax 2021-05-27 12:05:07 +02:00
Mohamed Abdelnour
a27814db8e Implement From<..> instead of Into<..> 2021-05-27 12:05:07 +02:00
Mohamed Abdelnour
9702f5256c Use the functional update syntax 2021-05-27 12:05:07 +02:00
Mohamed Abdelnour
23fd11e806 Use matches macro 2021-05-27 12:05:07 +02:00
Mohamed Abdelnour
304ee1489c Use !theme.is_empty() 2021-05-27 12:05:07 +02:00
Allen Wild
91a347bf6d Fix less version parsing for minor versions of less
Less 581.2 is here, and it has a ".2" in the version string, which can't
be parsed as a usize.

Update the check to find a non-digit character rather than a space. This
ignores the minor version, but parses the major version correctly.
2021-05-12 11:47:16 +02:00
Martin Nordholts
e04fbd1992 Include LESS in --diagnostic
So issues like #1586 are easier to troubleshoot.
2021-03-17 21:10:16 +01:00
Sean McLoughlin
d89fa3ebc2 Add SystemVerilog support 2021-03-15 07:21:15 +01:00
David Peter
2e7f2b6c07 'mut self' => 'self', remove pub 2021-03-07 14:59:10 +01:00
Aleksey Kladov
35347c2310 Improve readability
Using `Path`s for paths expresses intent more clearly.
2021-03-07 14:59:10 +01:00
Niklas Mohrin
694b31909a Change circle detection to use new more conservative method and run in main loop instead of before the loop 2021-02-28 23:04:49 +01:00
David Peter
ca60937c2e Do not ignore non-existent BAT_CONFIG_PATH
Do not ignore `BAT_CONFIG_PATH` if it doesn't exist. Both when
generating a new config file with `--generate-config-file` and
when attempting to read the config.

Also, provide a better error message in case the file can not
be created.

closes #1550
2021-02-28 10:08:24 +01:00
David Peter
94496df3b0 Fix broken resolv.conf highlighting
closes #1510

The change in `create_highlighted_versions.py` fixes a "unknown theme
"'1337'" warning. The single quotes were wrong. `bat` was always falling
back to the default theme, so let's use that for now.
2021-02-16 22:15:31 +01:00
David Peter
7eabb5e05a Highlight *.pac files as JavaScript
closes #1515
2021-02-16 21:52:52 +01:00
David Peter
9ad401be87 Fix clippy suggestion 2021-02-16 09:13:22 +01:00
Ethan P
f874c8e4db Use less binary specified in bat config for --diagnostic 2021-02-16 09:11:27 +01:00
Ethan P
025c5c061b Make less version check accept a path to the less binary 2021-02-16 09:11:27 +01:00
Caden Haustein
573f34d757
Update dependencies; replace unmaintained (#1522)
* Update dependencies; replace unmaintained

* Fix errors

* Revert dependency changes

* Revert git2 to 0.13.15

Co-authored-by: David Peter <mail@david-peter.de>
2021-02-16 08:50:41 +01:00
Martin Nordholts
dc1620d1f0 get_pager(): Simplify use_less_instead expression 2021-01-11 21:56:10 +01:00
Martin Nordholts
dd0d44bbb3 Fix #1413 Can't use bat at all! (Error: Use of bat as a pager is disallowed...)
Fixed by implementing the proposal by sharkdp:

* Allow PAGER=bat, but ignore the setting in bat and simply default to
  less. Unless of course, BAT_PAGER or --pager is used to overwrite the
  value of PAGER.

* Disallow the usage of bat within BAT_PAGER and --pager.
2021-01-11 21:56:10 +01:00
sharkdp
060b9981b5 Remove deprecated PrettyPrinter methods 2021-01-11 21:36:08 +01:00
sharkdp
1ae16fca90 Improve --map-syntax documentation, see #1386 2021-01-10 22:24:32 +01:00
Martin Nordholts
7809008016 PagerKind::from(): Simplify 2021-01-10 13:40:07 +01:00
Martin Nordholts
dd6f57e107 pager.rs: Some comment fixups 2021-01-10 13:25:18 +01:00
Martin Nordholts
dfe7a60140 PagerSource: [Bat]PagerEnvVar -> EnvVar[Bat]Pager 2021-01-10 13:16:09 +01:00
Martin Nordholts
fc30277cfa pager.rs: Limit visibilities to pub(crate) 2021-01-10 13:07:37 +01:00
Martin Nordholts
02e6ff4183 Merge remote-tracking branch 'origin/master' into fix-1063 2021-01-10 11:56:03 +01:00
sharkdp
c5c28eb05b --diagnostic: add MANPAGER environment variable 2021-01-09 21:56:17 +01:00
sharkdp
cd7be018fe Fix clippy suggestion: .or_else(|| Some(…)) => .or(Some(…)) 2021-01-09 19:43:39 +01:00
sharkdp
03a2710a08 Use new matches!(…) macro to simplify code 2021-01-09 19:43:39 +01:00
sharkdp
09fbabb0b8 Add a Default implementation for PrettyPrinter 2021-01-09 19:43:39 +01:00
mark chaitin
de6cb75f4b Addressed PR feedback. Upped min version and used matches! macro 2021-01-09 15:21:26 +01:00
mark chaitin
83c9cb7907 fix bug where long lines were truncated in plain mode without wrap=never not being set 2021-01-09 15:21:26 +01:00
Csaba Henk
fed30b1b36 Fix theme dir hint in --list-themes output 2021-01-08 20:10:45 +01:00
Martin Nordholts
da10166625 Merge remote-tracking branch 'origin/master' into fix-1063 2021-01-07 12:58:26 +01:00
sharkdp
26136be903 Add --diagnostics alias 2021-01-06 22:53:51 +01:00
sharkdp
6a52f69b58 Update to bugreport 0.3.0 2021-01-06 22:53:51 +01:00
sharkdp
60406c7c2d Exhaustive list of relevant environment variables 2021-01-06 22:53:51 +01:00
sharkdp
dec94b4111 Add config file, compile time info and less version 2021-01-06 22:53:51 +01:00
sharkdp
ebb97e94a9 Add --diagnostic option to bat 2021-01-06 22:53:51 +01:00
Martin Nordholts
46487b201f Merge remote-tracking branch 'origin/master' into fix-1063 2021-01-06 14:30:55 +01:00
Niklas Mohrin
21ae26cb17 Add cycle detection with clircle, now v0.2 2021-01-05 18:21:16 +01:00
Martin Nordholts
bfa5342331 Also replace 'more' from PAGER with 'less'
But first do some quite significant refactorings to keep the code clean
and easy to understand.
2020-12-30 17:59:30 +01:00
Martin Nordholts
22bdc7c20f When PAGER=most, don't print a warning to stderr, silently use less instead 2020-12-30 08:25:39 +01:00
Martin Nordholts
552545fe5f Merge remote-tracking branch 'origin/master' into fix-1063 2020-12-28 22:48:52 +01:00
Martin Nordholts
dcfe883f4b Simplify and polish pager.rs and related code 2020-12-28 22:39:34 +01:00
Martin Nordholts
05e9da390f bat cache --build: Print syntect error message for themes if any
This will fix #614 by making it clear what is wrong by showing the
following error message:

    Failed to load one or more themes from
    '/Users/me/.config/bat/themes' (reason: 'Invalid syntax theme
    settings')

We also need to add a check if theme_dir.exists(), otherwise an absent
dir will seem like an error:

    Failed to load one or more themes from
    '/Users/me/.config/bat/themes' (reason: 'IO error for
    operation on /Users/me/.config/bat/themes: No such file or
    directory (os error 2)')

(This is the same check we already have for syntax_dir.)
2020-12-28 22:32:56 +01:00
Martin Nordholts
cc0f8ca813 Merge remote-tracking branch 'origin/master' into fix-1063 2020-12-28 21:57:38 +01:00
Martin Nordholts
9c16571347 bat --list-languages: remove unnecessary format!() call
To trigger/verify the changed code, run

    bat --list-languages   # or -L

This is the last clippy warning in the code that you get if you run

    cargo clippy --all-targets --all-features -- --allow clippy::style

so by fixing it it becomes easier to spot when a new warning is
introduced (that does not belong to the clippy category clippy::style).
And by making it easy to spot new warnings, we increase chance of such
regressions not ending up in the code base.
2020-12-28 20:28:24 +01:00