Commit Graph

110 Commits

Author SHA1 Message Date
Tau Gärtli e72a95f3ab
Move actual detection into library 2024-04-16 14:43:31 +02:00
Tau Gärtli 4b1b600994
Expose new theme selection in CLI 2024-04-16 14:43:22 +02:00
David Peter f29f9387b5
Merge pull request #2868 from cyqsimon/builtin-offload-v2
Faster startup by offloading glob matcher building to a worker thread
2024-03-10 20:08:43 +01:00
einfachIrgendwer0815 83b00bc653
Rename `--squeeze` to `--squeeze-blank` 2024-02-24 14:02:27 +01:00
Ethan P 0e4e10edb6
Add --squeeze-limit to specify max number of consecutive empty lines
Co-authored-by: einfachIrgendwer0815 <85333734+einfachIrgendwer0815@users.noreply.github.com>
2024-02-24 13:51:06 +01:00
Ethan P c36ed32816
Add --squeeze/-s option
Co-authored-by: einfachIrgendwer0815 <85333734+einfachIrgendwer0815@users.noreply.github.com>
2024-02-24 13:51:00 +01:00
cyqsimon 2b4339663c
Builtin glob matchers build offload, v2 2024-02-21 14:56:37 +08:00
Oliver Looney c3f2ddf509
Merge branch 'master' into 2783-setting-terminal-title 2024-02-11 22:53:48 +00:00
Oliver looney 7ce010d9ed
Using hypens instead of underscores for set-terminal-title command 2024-02-08 21:33:03 +00:00
Oliver looney 9239b125b1
added a flag to config for setting terminal title 2024-01-27 14:14:40 +00:00
cyqsimon e4d637a3d8
Reverse precedence of syntax mappings specified on CLI 2024-01-18 22:41:57 +08:00
cyqsimon cfd622d6e1
Migrate `SyntaxMapping` impl to new system
Most existing builtins are removed but not yet ported, so the test
`user_can_override_builtin_mappings` should fail. It should pass once the old
rules have been ported.
2023-12-11 10:21:05 +08:00
Lena 28990bc451
fix: display color when NO_COLOR is an empty string (#2767) 2023-12-02 11:43:55 +00:00
Anomalocaridid b56021ffa9 make LESSOPEN support opt-in 2023-09-08 06:25:20 +02:00
Anomalocaridid e32ad0b048
Add `$LESSOPEN` and `$LESSCLOSE` support (#2444) 2023-09-02 08:48:26 +02:00
mataha 82664e3c82 Bump MSRV to 1.70.0
The intention is to take advantage of `std::io::IsTerminal` that landed
in 1.70.0, both in `bat` and its dependencies (`clap`, `grep-cli`).

This will fix #2570 as well - `grep-cli` 0.1.9 has a patch for that.

Signed-off-by: mataha <mataha@users.noreply.github.com>
2023-09-01 05:42:45 +02:00
Nigecat 149dec6953 Fix paging not happening when stdout is interactive but stdin is not 2023-05-22 05:42:01 +02:00
Constantin Nickel 57cc0d8435 Use the `is-terminal` crate instead of `atty`
The crate is already used by `clap` and a similar trait is about to be
stabilized in `std`.
2023-04-05 19:26:52 +02:00
Constantin Nickel da3aa4e2fd Use `nu-ansi-term` instead of `ansi_term`
The `nu-ansi-term` crate is a fork of `ansi_term` which is maintained by
the Nushell project.
2023-03-24 17:42:54 +01:00
einfachIrgendwer0815 8f99a78cf1
Print non-printable characters using caret notation (#2443)
When the new flag is set, non-printable characters are printed using caret notation.
2023-03-14 22:21:30 +01:00
Aaron Kollasch e773b48135
Fix cache subcommand and add tests
Treat the cache subcommand differently from --no-config:
For --no-config, insert args from selected environment variables
For cache, don't insert args
2022-11-02 16:48:51 -04:00
Aaron Kollasch 4bcea01e9d
Deduplicate lines in matches function 2022-11-02 16:48:51 -04:00
Aaron Kollasch 76aad7c74f
Improve correctness and add more tests 2022-11-02 16:48:50 -04:00
Aaron Kollasch 36ccc6a31e
Allow env vars to override config but not args 2022-11-02 16:48:50 -04:00
David Peter a65b0828ee Merge remote-tracking branch 'origin/master' into HEAD 2022-10-30 20:43:06 +01:00
John Higgins 236a2c5794
Fixed inverted logic on -S and --chop-long-lines 2022-10-13 23:52:15 -07:00
John Higgins 375b392478
Fixed reversed logic error for --chop-long-lines 2022-10-09 22:41:27 -07:00
Gábor Lipták 1e0b0f7c5c Add github-actions to Dependabot
Signed-off-by: Gábor Lipták <gliptak@gmail.com>
2022-10-03 15:18:39 -05:00
John Higgins a272d3df16
Added -S flag for truncating long lines 2022-09-09 17:04:09 -07:00
Ed Page 3d398b35c3 refactor: Switch from is_present to actions
Because "diff" is conditionally present, we need to check for it to
avoid some of clap's stricter checks meant to prevent bugs.
2022-09-03 14:01:56 +02:00
Ed Page 6099f2c146 refactor: Move off of value_of 2022-09-03 14:01:56 +02:00
Ed Page 50bb924ee3 refactor: Replace multiple_occurrences 2022-09-03 14:01:56 +02:00
Ed Page e8e1c1d6c9 refactor: Replace allow_invalid_utf8 with PathBuf 2022-09-03 14:01:56 +02:00
Ed Page 2323804f7e refactor: Port to clap3
Ths does remove the specialization of version's description.  The way
this is done (internally through `mut_arg`) doesn't play well with
subcommands.  Clap tries to force this version of `version` into the
subcommand despite not being needed.  Clap v4 dramatically changes how
version customization works.

clap also does more error checks now to prevent programmer mistake, so
we can't have a conflict with an argument that is conditionally there,
so I swapped the condition.
2022-09-03 14:01:56 +02:00
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
2022-05-04 21:31:32 +02:00
Martin Nordholts e250da8aaa Run `cargo clippy --fix --all-targets --all-features` with Rust 1.57
Clippy in the newly released Rust 1.57 found some new lints. Conveniently, all
of them were fixable with `--fix`.
2021-12-08 08:45:04 +01:00
Bojan Đurđević d6ed5e6746
Support for ignored-suffix CLI arguments (#1892) 2021-11-19 17:05:23 +01:00
Martin Nordholts 19c3e82abf
Replace deprecated 'error-chain' with 'thiserror' (#1820)
We can't use #[from] on Error::Msg(String) because String does not implement Error.
(Which it shouldn't; see e.g. https://internals.rust-lang.org/t/impl-error-for-string/8881.)
So we implement From manually for Error::Msg, since our current code was written
in that way for error-chain.
2021-08-26 13:12:21 +02:00
Martin Nordholts ed09f90e5e Fix all lints that are new with Rust 1.54
They are all of the following type:
https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
2021-08-19 07:19:12 +02:00
Martin Nordholts 5236ed135e Fix typo in unreachable!(..) message for --wrap 2021-08-08 06:40:18 +02:00
Martin Nordholts b040efff79 Support a hidden arg --no-custom-assets that skips loading assets from the cache 2021-07-29 08:27:02 +02:00
Aleksey Kladov 35347c2310 Improve readability
Using `Path`s for paths expresses intent more clearly.
2021-03-07 14:59:10 +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
Martin Nordholts 47bb4a9c0f Introduce bat_warning! helper macro
This macro is intended to be package-internal and is not to be
considered part of the public lib API.

Use it in three places to reduce code duplication. However, main reason
for this refactoring is to allow us to fix #1063 without duplicating the
code yet another time.

The macro can also be used for the "Binary content from {} will not be
printed to the terminal" message if that message starts to use eprintln!
instead (if ever).

To trigger/verify the changed code, the following commands can be used:

    cargo run -- --theme=ansi-light tests/examples/single-line.txt
    cargo run -- --theme=does-not-exist tests/examples/single-line.txt
    cargo run -- --style=grid,rule tests/examples/single-line.txt
2020-12-28 09:27:40 +01:00
Martin Nordholts 6d1c7d5f57 Fix clippy::if_same_then_else warning in --paging=auto logic 2020-12-28 09:21:27 +01:00
sharkdp 1fbdef06aa Use unreachable!(…) 2020-11-23 14:25:01 +01:00
MarcoIeni 2ccff145ed remove unuseful matches expression 2020-11-23 14:25:01 +01:00
MarcoIeni 43b2ee5e71 fix some clippy warnings 2020-11-23 14:25:01 +01:00
Tom Milligan 3015ebfba1
disable rule when grid enabled, and print warning 2020-10-12 09:04:57 +01:00
sharkdp 5df449bcf3 Remove unnecessary parenthesis 2020-09-14 11:24:14 +02:00