Commit Graph

101 Commits (6db64cf050f0425d059d5c8bf3dfd9fdd98d9976)

Author SHA1 Message Date
Isaac Horvath adea895026
Add a --style=default option (#2119)
* Add a --style=default option

* Added --style=default test and CHANGELOG entry

* Format CHANGELOG.md options with quotes

Co-authored-by: Martin Nordholts <enselic@gmail.com>

* Update help text for '--style'

* Make --style=default the default option

* Update style descriptions: "basic" -> "recommended"

* Add integration test for --style=default as default

* Update clap long help for --style
2 years ago
Keith Hall b5294f1cb2
Skip syntax highlighting for long lines (#2165)
* Skip highlighting for long lines

* Run cargo fmt, update changelog
2 years ago
David Peter 6330f36495 Updated test names 3 years ago
Patrick Hilhorst e7df748b6d correctly handle multiple tabs in one line 3 years ago
Patrick Hilhorst 67124f8513 add show_all_tabstops_long integration test 3 years ago
Patrick Hilhorst 16f940c2d3 add show_all_tabstops integration test 3 years ago
cyqsimon 14ddda0a8b
Recognize files in `$XDG_CONFIG_HOME/git/` and `$HOME/.config/git/` better (#2067)
* git global config - lookup $XDG_CONFIG_HOME faithfully

* Use `bool::then`

* Cover both `$XDG_CONFIG_HOME` & `$HOME/.config`

* Remove unused import

* Global git config tests

* Added trailing newline

* Fix git config test

* Wrote to changelog

* Revert change of `Result::ok` to `Result::unwrap`

* Apply suggestions from code review

Co-authored-by: Martin Nordholts <enselic@gmail.com>

* Guard against empty `$HOME`

Co-authored-by: Martin Nordholts <enselic@gmail.com>
3 years ago
Mahdi Dibaiee d21f1e8f17
Underline highlighted lines in ANSI theme (#1985)
* Underline highlighted lines in ANSI theme

* add test for ansi highlight underline, fix underscore in plain
3 years ago
Mahdi Dibaiee 312c8ef01f
Add new `--style` called `header-filesize` and display it by default (#1988)
Also rename `header` to `header-filename`.

Related to #1701
3 years ago
Martin Nordholts a3ea798246
Credit syntax definition and theme authors with new `--acknowledgements` option (#1971)
The text that is printed is generated when building assets, by analyzing LICENSE
and NOTICE files that comes with syntaxes and themes.

We take this opportunity to also add a NOTICE file as defined by Apache License 2.0.
3 years ago
Ethan P 63ad53817d
Improved ANSI passthrough (#1596)
Improve handling of ANSI passthrough. Fix ANSI passthrough for --wrap=never. Add test for ANSI passthrough.
3 years ago
Bojan Đurđević d6ed5e6746
Support for ignored-suffix CLI arguments (#1892) 3 years ago
Martin Nordholts 9ed9a6fc3d
Simplify HighlightingAssets::get_syntax() first_line logic (#1852)
And make self.get_first_line_syntax() be called lazily.
3 years ago
David Peter 27f046ec03 Consolidate environment variable lists
We want to make sure that all of our test environments are clean from
possible outside modification. This consolidates the list of used
environment variables in Rust-based and Python-based integration tests.

Note that there is also a similar list in `src/bin/bat/main.rs` which
is even more exhaustive (for bug report collection). However, some
of these variables can not possibly have an effect on test environments.
3 years ago
Martin Nordholts f5c1cb2dff Run 'cargo fmt' 3 years ago
Bill Risher 6c62ed5608 revamped integration test, made CHANGELOG changes 3 years ago
Bill Risher bf78288e9e feat(config): added recognition of $BAT_CONFIG_DIR 3 years ago
Martin Nordholts 89217e0d58 Make --no-paging and --no-pager work again 3 years ago
Martin Nordholts bd797c75a4 integration_tests: Add diagnostic_sanity_check() 3 years ago
Martin Nordholts b040efff79 Support a hidden arg --no-custom-assets that skips loading assets from the cache 3 years ago
Niklas Mohrin b8a18d3ebb Use tempfiles for clircle tests 4 years ago
Martin Nordholts 3af3549232 integration_tests: Use tempdir() in config_location_when_generating
For cleaner code.

Use the tempdir() function since that is recommended by the crate docs:
https://docs.rs/tempfile/3.2.0/tempfile/index.html
4 years ago
Martin Nordholts 643f0bcbe3 integration_tests.rs: Add test config_location_when_generating
As a complement to #1556 to prevent #1550 from coming back.

The test purposefully fails if ca60937c2e is reverted.
4 years ago
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
4 years ago
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>
4 years ago
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.
4 years ago
Martin Nordholts eda72c31b2 tests: Move 'mocked pagers' utils to separate file 4 years ago
Martin Nordholts c2c2b0211a fn mocked_pager: Simplify with format! 4 years ago
Martin Nordholts dd6f57e107 pager.rs: Some comment fixups 4 years ago
Martin Nordholts da10166625 Merge remote-tracking branch 'origin/master' into fix-1063 4 years ago
sharkdp 35e3c51b75 Fix unused import warning 4 years ago
sharkdp 59c9105c25 Fix clippy warnings in tests on Windows 4 years ago
Martin Nordholts 46487b201f Merge remote-tracking branch 'origin/master' into fix-1063 4 years ago
Martin Nordholts 9ccb667653 Add integration test for unparsable pager
Right now all tests pass even if we e.g. return

    Ok(OutputType::stdout())

instead of doing

    .chain_err(|| "Could not parse pager command.")?

so add a test to make sure this functionality don't break.
4 years ago
Niklas Mohrin b600f62ab6 Add unix specific integration test about running bat without any arguments 4 years ago
Niklas Mohrin ace655e164 Add integration tests for clircle cycle detection 4 years ago
Martin Nordholts e87c554ccd tests: Make mocked pagers work on Windows 4 years ago
Martin Nordholts df33ed05dd Run PATH-dependent tests serially
Since PATH is a shared resource.
4 years ago
Martin Nordholts c9efdd68ed Add integration tests for 'more' and 'most' used as pagers 4 years ago
Martin Nordholts 22bdc7c20f When PAGER=most, don't print a warning to stderr, silently use less instead 4 years ago
Martin Nordholts dcfe883f4b Simplify and polish pager.rs and related code 4 years ago
Martin Nordholts cc0f8ca813 Merge remote-tracking branch 'origin/master' into fix-1063 4 years ago
Martin Nordholts a63bb08eda Add test 'grid_for_file_without_newline' (for issue #299 fix)
This is a regression test for the fix for issue #299. If that fix is
reverted, currently only one test ('header_padding') fails. But that
test is for a different use case, so add a dedicated regression test for
the particular use case issue #299 is about.
4 years ago
sharkdp 3e9afe2974 Add integration test for nonexisting newline 4 years ago
Martin Nordholts 986d0e9777 Ignore PAGER=most by default with a warning to stderr
closes #1063
4 years ago
sharkdp bd2e9917da Revert "Add cycle detection integration tests"
This reverts commit ec60d84265.
4 years ago
Niklas Mohrin 4f0116bee7 Add cycle detection integration tests 4 years ago
Ethan P 61f947a580
Merge pull request #1276 from tommilligan/style-rule
style: add component 'rule' for horizontal file delimiter
4 years ago
Adrian Rivera 9837948c3a Throws an error when `bat` is being user as pager.
As mentioned on #1334 `bat` should not be used as a value for `pager`,
this change checks both the balue of `bat` provided as a parameter or
as an environment variable.
4 years ago
Tom Milligan 1614f80366
add integration test for grid overriding rule 4 years ago