Commit Graph

86 Commits

Author SHA1 Message Date
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
Alexander Karlis 6017989c4c removed printlns, updated Changelog, updated man 2020-09-14 11:24:14 +02:00
Alexander Karlis d349974089 updated PR based on comments 2020-09-14 11:24:14 +02:00
Alexander Karlis ccdea6a429 remove println 2020-09-14 11:24:14 +02:00
Alexander Karlis fdf11326ef added additional alias for color=always when always-decorations flag is triggered 2020-09-14 11:24:14 +02:00
Alexander Karlis 565a80305c Added new alias for 'decoration=always' 2020-09-14 11:24:14 +02:00
Dash Peters 5fdeeabb44 Change to name no-paging, add long flag and alias 2020-07-01 21:35:45 -07:00
Dash Peters 2575aae945 Add short flag for --paging=never 2020-06-30 12:19:22 -07:00
Ethan P 9d08c0102e Replace Input::stdin_as_file with bat-application functions 2020-05-29 22:13:10 +02:00
Ethan P 7a9decad70 Remove Input.as_file and add Input::stdin_as_file 2020-05-29 22:13:10 +02:00
Ethan P 798b742617 Refactor InputDescription API into Input API 2020-05-29 22:13:10 +02:00
Ethan P 8b481dd41f Add support for NO_COLOR env var (#1021) 2020-05-28 21:49:10 +02:00
Ethan P 887e61a99d
Allow application to be built without git support
Caveats:
The help descriptions aren't changed with you remove the "git" feature.
2020-05-15 13:58:48 -07:00
sharkdp 8e18786556 Run 'cargo fmt' 2020-04-24 16:11:05 +02:00
sharkdp 81488adf8b Use unreachable!(…) 2020-04-24 16:11:05 +02:00
Lzu Tao e37e9c1214 Fix some clippy lints
Some might actually improve perf
2020-04-24 16:11:05 +02:00
sharkdp 82e7786e74 Implementation of 'bat --diff'
This adds a new `--diff` option that can be used to only show lines
close to Git changes (added/removed/modified lines). The amount of
additional context can be controlled with `--diff-context=N`.

closes #23
2020-04-24 09:57:57 +02:00
sharkdp 5d71056209 Fix import in app 2020-04-22 23:55:28 +02:00
sharkdp 8961f7aef8 Move PagingMode to separate module 2020-04-22 23:55:28 +02:00
sharkdp 261a7ea154 Add *_with_name methods 2020-04-22 23:55:28 +02:00
sharkdp 702cb198da Rename error module 2020-04-22 23:55:28 +02:00
sharkdp 6a124591df Easier configuration of style components 2020-04-22 23:55:28 +02:00
sharkdp 0cde4e9121 Numbers => LineNumbers 2020-04-22 23:55:28 +02:00
sharkdp ec0ce05455 Better API for highlighting lines 2020-04-22 23:55:28 +02:00
sharkdp 13e6b3fac7 Reduce public API 2020-04-22 23:55:28 +02:00