Commit Graph

482 Commits (8821bca6567264fd5901e659fcddfd86e37822d9)

Author SHA1 Message Date
sharkdp fedd32173e Restructure and fix bug in line range module 5 years ago
sharkdp 4855a47105 Rename enum field 5 years ago
sharkdp 06b7be7ee9 Major restructuring of theme/syntax handling 5 years ago
Kyle Criddle cfa2cb6ec7 --file-name for normal files. integration tests. 5 years ago
Kyle Criddle b1b8addf7e remove unnecessary Some() 5 years ago
Kyle Criddle 4be5adc6f5 remove absolute path restraint from BAT_CACHE_PATH 5 years ago
Kyle Criddle a9a31dca7f Specify cache dir with BAT_CACHE_DIR
- if set, BAT_CACHE_DIR is used. otherwise use OS default.
5 years ago
Kyle Criddle 517be5c7bc Implement --file-name<name> option
- can specify filename to be displayed when printing.
- useful for when piping data from STDIN

Closes #654
5 years ago
Pavel Aslanov 4021cf8128 Support combination of multiple styles at the same time
Old version of the code did not allowed for `bold italic` or `bold underline` styles
5 years ago
sharkdp ca066bf7cd Run 'cargo fmt' 5 years ago
Kogia-sima 25640a8a81 Fix bug where max_width is not initialized after line break 5 years ago
Kogia-sima 944866affd Fix wrapping method to support unicode text
Related issues:
- #787
- #811
5 years ago
Ethan P 1225e65299 Fix #798 5 years ago
sharkdp 7779d9f622 Allow for non-unicode filenames, closes #225 5 years ago
Liam Kalir 5ef1c6cce2 Grammar touch-ups, more descriptive error message for invalid line
ranges
5 years ago
Liam Kalir 93881d9a64 Adds range syntax for line highlights 5 years ago
sharkdp 8d0b8a227b Add test for less 529 5 years ago
sharkdp e400ebd1bd Also pass '--no-init' if version could not be retrieved 5 years ago
sharkdp 67fe804256 Do not pass '--no-init' on newer less versions
With this change, we do not pass the `--no-init` option in newer
versions of less (530 or higher).

This fixes #749
5 years ago
sharkdp 20ba984c6d Update help text, closes #713 5 years ago
fusillicode 6311ca22f9 Add check for terminal-width in output_wrap config value in not interactive case
Co-authored-by: allevo <tomallevi@gmail.com>
Co-authored-by: gildo <gildo.fiorito@gmail.com>
5 years ago
sharkdp 40e5befdc7 Minor change 5 years ago
Franco Victorio f94ff93953 Accept "default" as a theme 5 years ago
Mohamad Barbar 3523f60299 Leave blank lines blank terminal output.
Would add some ANSI colour codes previously.
5 years ago
sharkdp 850677f121 Remove 'advanced' example 5 years ago
sharkdp c132e19e74 Make a few modules private 5 years ago
sharkdp 3334f74b72 Remove custom 'transpose' function 5 years ago
sharkdp b9ce3c248c Simplify 'using_controller' example 5 years ago
Helder M 3b5fcf4619 Update options sort order in --help and manpage file
This commit updates the sort order of --help options in order to improve
usability/importance putting most useful/used commands on top. In
addition to that, similar options were grouped together.
5 years ago
Fahmi Akbar Wildana e287594654 Fix compile-error on Rust v1.35.0 5 years ago
Fahmi Akbar Wildana 2253d07341 Derive fmt::Debug whenever possible 5 years ago
Fahmi Akbar Wildana 7208a63a49 Implement trait Default for struct Config 5 years ago
Fahmi Akbar Wildana 0273848f54 Run `cargo fmt` 5 years ago
Fahmi Akbar Wildana e542621125 Move back printer.rs and others into lib
others:
bin/bat/{controller,decorations,output,printer}.rs
5 years ago
Fahmi Akbar Wildana 26439b41d2 Move Config,PagingMode from app.rs into lib.rs 5 years ago
Fahmi Akbar Wildana a2ee753b25 Move config.rs into src/bin/bat/ 5 years ago
Fahmi Akbar Wildana 837d0998da Remove unused macros in bin/bat 5 years ago
Fahmi Akbar Wildana 23d80f9e84 Fix all compile errors in bin/bat
* Change `mod errors` in lib.rs to public

* Add `fn handle_error` in lib.rs errors module
5 years ago
Fahmi Akbar Wildana e981bd88c1 Move src/bin/* into src/bin/bat/
This will limit [[bin]] to *bat* only which will make:
- `cargo run` works without specifying --bin
- prevent `cargo build --bins` to produce multiple binaries (app,clap_app,...)
5 years ago
Fahmi Akbar Wildana 710a1df4ff Fix all compile warnings in lib.rs 5 years ago
Fahmi Akbar Wildana cfd33168af Fix all compile errors in lib.rs 🚚
* Move {controller,output,printer,decorations}.rs into src/bin/

* Add `mod errors` from main.rs
5 years ago
Fahmi Akbar Wildana eefdb186b8 Add lib.rs 5 years ago
Fahmi Akbar Wildana fc0ad4db2e Move {main,app,clap_app}.rs into src/bin/ 5 years ago
sharkdp f5d359927a Fix 'bat cache other-arg', closes #666 5 years ago
sharkdp 26f9125ebb Re-formulate help text 5 years ago
sharkdp 9814eab13f Suppress warning in -A mode 5 years ago
sharkdp 82ca8804a2 Handle non-unicode characters in the preprocessor 5 years ago
pjsier b48b9fcf3b Display binary file content for bat -A 5 years ago
sharkdp 2e71146801 Fix another instance of the 'bat cache' bug, closes #584 5 years ago
sharkdp ec908d5937 Run 'cargo fmt' 5 years ago
sharkdp 63d652dab5 Add 'dyn' keyword for trait references 5 years ago
Ethan P 7f2e61d579 Add new style component to separate multiple '--line-range's 5 years ago
sharkdp e289a2c698 Add short '-L' option as an alias for --list-languages 5 years ago
Wild Kat 28266ee441 use explicit dyn with Write to appease compiler 5 years ago
Ethan P 772ce2e4fe Print a horizontal header line when 'grid' style without 'header' style 5 years ago
sharkdp 76c615a304 Allow leading minus in '--terminal-width <value>'
closes #611
5 years ago
Fernando Mendes c9d7e3652b Enforce the creation of the full cache dir path
Fixes #576
5 years ago
sharkdp 9b1b3dda14 Only print the header for empty files
Instead of printing
```
───────┬─────────────────────────────────────────────────────────
       │ File: some-file
───────┼─────────────────────────────────────────────────────────
───────┴─────────────────────────────────────────────────────────
```
for empty files, bat will now print
```
───────┬─────────────────────────────────────────────────────────
       │ File: some-file   <EMPTY>
───────┴─────────────────────────────────────────────────────────
```
5 years ago
sharkdp 5b2b594919 Revert "Run 'cargo fmt'" (outdated rustfmt)
This reverts commit dd40f7545d.
5 years ago
sharkdp 9d53ce6be6 Fix warning 5 years ago
sharkdp dd40f7545d Run 'cargo fmt' 5 years ago
sharkdp c709bf2103 Print a warning message instead of just '<BINARY>' 5 years ago
Maksim Panfilov f37dbb80a8 Added printing of "<BINARY>" for binary files in the interactive mode if header decorations are turned off 5 years ago
sharkdp 0a1e08da96 Extend help text for --terminal-width and --wrap, closes #535 5 years ago
Ethan P 493a4e719e Added non-interactive mode for `--list-languages`
This makes scripting it a lot easier and less hacky.
5 years ago
sharkdp 72152296c7 Fix accidental printing of files named 'cache'
This also adds two regression tests, so this will hopefully not pop up
again.

closes #557
5 years ago
Ethan P 2b9d25df05 Replace iterator with string starts_with and ends_with 5 years ago
Ethan P cc8186103b Reformatted with `cargo fmt`. 5 years ago
Ethan P 0ad09df7ab Improved logic when encountering ANSI in character wrap mode
Fixes #551
5 years ago
Ethan P 7ef0fe091d Cleaned up terminal-width validation even more 5 years ago
Ethan P 89fcbb2b15 Cleaned up terminal-width validation slightly 5 years ago
Ethan P a7e2bb86cb Add validation for --terminal-width option 5 years ago
sharkdp 1ce0bc8e0d Slightly modified help text 5 years ago
Ethan P fde00eec98 Add -pp for plain styling and no pager 5 years ago
Mitchell Kember bb6594e691 Add 3 new themes: ansi-light, ansi-dark, base16
Also, interpret transparent colors (#RRGGBB00) as specifying a terminal
color palette number with RR. The three new themes use this.
5 years ago
Daniele Esposti f259ff2920 Formatted code 6 years ago
Daniele Esposti 82f14121bd Applied linter fixes 6 years ago
Daniele Esposti a21ae614e6 Migrated to Rust 2018 6 years ago
sharkdp f0771d6532 Do not replace arguments to pager when --pager is used, closes #509 6 years ago
Reid Wagner 76b7418e35 Only print contents if file wasn't empty, or EOF wasn't first thing received from stdin. 6 years ago
Reid Wagner 10c5f79640 Revert "Check result of read_until, and return Error if 0, which indicates EOF was found before delimeter."
This reverts commit 61e888de7f.
6 years ago
sharkdp 9e11d66979 Handle UTF-16 encoding errors with replacement characters 6 years ago
sharkdp e09499b3df Move config-dir and cache-dir from 'bat cache' to 'bat' 6 years ago
sharkdp cff01d81fa Rename 'bat cache --init' to 'bat cache --build' 6 years ago
sharkdp 6e8fca5bb2 Replace less command line arguments only for PAGER 6 years ago
Park Juhyung 63c77383ce Ignore flags from PAGER env var if the program is 'less' 6 years ago
sharkdp 4df22e617f Update documentation 6 years ago
sharkdp 6473e8c1be Remove import 6 years ago
sharkdp 972a764a74 Simplify Optional handling 6 years ago
sharkdp 54143d1403 Add --cache-dir option 6 years ago
sharkdp 6523bbf62f Replace 'is_absolute_path' with map and filter 6 years ago
Lavi 05e2c2c66b removed compile errors and warnings on non-macs 6 years ago
Lavi 69227222b5 config and cache now check XDG env vars first
`XDG_CACHE_HOME` and `XDG_CONFIG_HOME` are checked first and fall-back
to `~/.cache/` and `~/.config/`.
6 years ago
Lavi 49af3e854b Set cache_dir on MacOS to ~/.cache/bat/ 6 years ago
Lavi 6a8e4757b7 Updated bat config dir for MacOs
Removed directories crate and using dirs_rs
Changed bat config file and cache dir on MacOs:
config: ~/.config/bat/config
cache: ~/.config/bat/cache/
6 years ago
Reid Wagner 61e888de7f Check result of read_until, and return Error if 0, which indicates EOF was found before delimeter. 6 years ago
sharkdp bd68684537 Fix the number of values to one 6 years ago
sharkdp c2847f6a9f Short options for line-range and highlight-line 6 years ago
sharkdp cf7ed042c1 Colorize the whole line 6 years ago
sharkdp 6b92814ea0 Allow for multiple highlighted lines 6 years ago
sharkdp a236a9b195 Merge branch 'master' of https://github.com/tskinn/bat into tskinn-master 6 years ago
sharkdp fee57d71d9 Print ANSI-reset code before newline
fixes #379
6 years ago
sharkdp 397def1320 Omit launching of pager if NO file exists
closes #387
6 years ago
ufuji1984 4ff360669f add quotes around filename
and make it more concise by using map_err
6 years ago
ufuji1984 549e5d7355 Report filename if File::open return Err
From issue #441
6 years ago
Ole Martin Ruud 348c9f3562 Enhance SyntaxMapping with impl Trait 6 years ago
Ole Martin Ruud 6b6a8f8e16 Fix doc comment typo 6 years ago
Arnav Borborah 532af6556d Use Rust inclusive range (stable in 1.26) 6 years ago
sharkdp f98a96c1ed Update help text 6 years ago
sharkdp 7cac07d845 issue #383: Handle cases like `PAGER=/usr/bin/bat` 6 years ago
Rodrigo Orem 148caa1381 Fix code style 6 years ago
Rodrigo Orem ab27cac0cc Remove args when change from bat to less 6 years ago
Rodrigo Orem 01fcbf2183 Better placement of bat detection 6 years ago
Rodrigo Orem 8a0c30b385 Avoid endless bat executions with PAGER="bat"
From issue #383
6 years ago
Nisheet Sinvhal 18d1a3b973 Changed italics to use-italic-text in config
Better placing of italics in help and also added long_help for it
6 years ago
Nisheet Sinvhal dc10246bd2 Linting 6 years ago
Nisheet Sinvhal 44bdae0212 Linting 6 years ago
Nisheet Sinvhal 1ece38a4c4 Changed flag name 6 years ago
Nisheet Sinvhal e90308e1f8 italics enable|disable working 6 years ago
Nisheet Sinvhal d702d6740c Added args 6 years ago
Ricky 558134f6c8 Changed to unwrap methods, added integration tests 6 years ago
Ricky 1dd57e6d7e Ran rust fmt 6 years ago
Ricky 20ba84d1fa Added in environment variable and the result is a file check in config.rs 6 years ago
sharkdp e81f9b23e6 Fix `--show-all` for UTF-16 encoding 6 years ago
sharkdp 50dc4a79b0 Display line-feed as instead of 6 years ago
sharkdp 8fa8f44706 Use `↹` character if tab-width == 1. 6 years ago
sharkdp ecd862d9ff Feature: Highlight non-printable characters
Adds a new `-A`/`--show-all` option (in analogy to GNU Linux `cat`s option) that
highlights non-printable characters like space, tab or newline.

This works in two steps:
- **Preprocessing**: replace space by `•`, replace tab by `├──┤`, replace
newline by `␤`, etc.
- **Highlighting**: Use a newly written Sublime syntax to highlight
these special symbols.

Note: This feature is not technically a drop-in replacement for GNU `cat`s
`--show-all` but it has the same purpose.
6 years ago
sharkdp 4492d99556 Change default tab width to 4 6 years ago
sharkdp dda27b253b Allow offset values in `--terminal-width`
Allows the `width` argument to `--terminal-width` to be an offset
instead of an absolute number. Examples:

    --terminal-width=80   # Set output width to 80 characters
    --terminal-width=-2   # Set output width to actual_width - 2

closes #376
6 years ago
David Peter abcd09f869 Remove commented-out code 6 years ago
Sindre Johansen 41a5ff039b Only use the last argument of {style,plain,number} 6 years ago
Sindre Johansen 155bad3862 Rustfmt 6 years ago
Sindre Johansen 7c98a1c901 When specifying style multiple times the last occurence wins
Closes: #367
6 years ago
David Peter c1246fcd53 Update help text 6 years ago
David Peter 9f401ea122 Update docstring 6 years ago
Park Juhyung 9c782fb692 Fix format error 6 years ago
Park Juhyung 154186a58d Add --pager option 6 years ago
sharkdp 496e0bc046 Allow for multiple line ranges
See #23
6 years ago
sharkdp 30b742e984 --map-syntax takes just one value 6 years ago
sharkdp 671deeef8c Update help text 6 years ago
sharkdp 8dc7e2efa3 Add --config-file option 6 years ago
sharkdp 10965a6122 Implement syntax mapping
This adds a `-m`/`--map-syntax` option that allows users to (re)map
certain file extensions or file names to an existing syntax.

For example:
```
bat --map-syntax .config:json
```

The option can be use multiple times. Note that you can easily make
these mappings permanent by using `bat`s new configuration file.

closes #169
6 years ago
sharkdp e43d97dc15 Small cleanup 6 years ago
sharkdp bb1f5aa841 Add proper handling of empty PAGER variables 6 years ago
sharkdp 2109a7830b Add error handling for parsing errors 6 years ago
sharkdp ec27c78a8a Remove duplicate 'extern crate' 6 years ago
Morten Linderud 67fe833bc8 Add arguments from PAGER/BAT_PAGER
Solves #352

Signed-off-by: Morten Linderud <morten@linderud.pw>
6 years ago
sharkdp 25a6a55437 Revert "Fix for older version of Rust"
This reverts commit c530fadc44.
6 years ago
sharkdp 5bff4548be Add BAT_OPTS environment variable 6 years ago
sharkdp 866b9e16a8 Add error handling 6 years ago