Commit Graph

996 Commits

Author SHA1 Message Date
Tau Gärtli
1423dd9440
Choose theme based on the terminal's color scheme 2024-08-16 14:09:35 +02:00
Ethan P.
aa3ec109b7
First StyleComponentList should remove from 'auto' style.
This happens when there are no `--style` arguments other than the one
passed in as a command line argument.

Prior to this change, removing a style component (e.g. `--style=-numbers`)
would remove the component from an empty style component set, resulting
in no styles at all. That behaviour was less intuitive than the new
behaviour, which starts out with the default components and
removes the line numbers.
2024-07-30 21:22:02 -07:00
Ethan P.
93b25d75a0
Join env var options with "=" instead of " "
Joining them with a space was causing certain styles (e.g. `-grid`) to
be misinterpreted as a separate option.
2024-07-30 21:21:58 -07:00
Ethan P.
6e91ba83b7
Update clap/docs for merging --style arguments 2024-07-30 21:21:55 -07:00
Ethan P.
b74c125c43
Support merging --style arguments
The `overrides_with` clap builder option was removed
because it interfered with the matcher's ability to
retain all occurrences of `--style`.

The behavior it covered is expressed within the new
`forced_style_components` function.
2024-07-30 21:21:53 -07:00
Michael Vorburger
23fd200482 Associate JSON-LD .jsonld files with json syntax (fixes #3036)
Use PR instead of Issue # number in CHANGELOG.

Clean up (unify) CHANGELOG.
2024-07-27 15:48:02 +02:00
cyqsimon
7bd6cdbebc
Add syntax mapping for kubernetes config files 2024-07-26 23:23:58 +08:00
Ethan P.
3f22311ec8
Add ANSI stripping to bat-as-a-library 2024-06-17 18:27:39 -07:00
Ethan P.
9e8176b1c6
Add --strip-ansi=auto option
When using `auto`, escape sequences will be stripped unless printing
plain text.
2024-06-17 18:27:33 -07:00
Ethan P.
70ff93d238
Add --strip-ansi option 2024-06-16 16:49:07 -07:00
Ethan P.
9c76b72825
Update expand_tabs to use bat's ANSI iterator 2024-06-10 20:07:54 -07:00
Ethan P.
b4fe182960
Make EscapeSequenceOffsetsIterator pub, add fns to get indices 2024-06-10 20:04:17 -07:00
cyqsimon
3a9d574770
Add syntax mapping for /etc/pacman.conf 2024-05-15 14:31:25 +08:00
Stéphane Blondon
bb4d1cbd2e refactor: factorize constants by inverting loop and condition order 2024-04-19 11:44:47 +02:00
Stéphane Blondon
23ec433167 display which theme is the default one in basic output 2024-04-19 11:44:47 +02:00
sblondon
d5bd4aa93f
display which theme is the default one in colored output (#2838) 2024-04-14 15:54:52 +02:00
Rivera Calzadillas
f8c5429a6c Print $TERM with --diagnostic 2024-04-07 14:24:16 +02:00
Rivera Calzadillas
f71226adbb Sort env vars printed by --diagnostic 2024-04-07 14:24:16 +02:00
Hamir Mahal
07c26adc35 style: simplify equality check 2024-03-11 18:57:51 +01: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
Hamir Mahal
c290bfff1e refactor: remove reference that is unnecessary 2024-03-10 11:17:02 +01:00
cyqsimon
46a2c004a2
Add syntax mapping for Wireguard config 2024-02-29 14:25:20 +08:00
cyqsimon
26ac179548
Add note on thread synchronization 2024-02-26 11:31:30 +08:00
Lena
4c85483486 Inline format! args wherever possible 2024-02-25 00:38:11 +01:00
einfachIrgendwer0815
83b00bc653
Rename --squeeze to --squeeze-blank 2024-02-24 14:02:27 +01:00
einfachIrgendwer0815
f041ff8c5f
Hide --squeeze-limit from short help 2024-02-24 13:57:44 +01:00
einfachIrgendwer0815
6c2ce63101
Add squeeze functionality to SimplePrinter 2024-02-24 13:51:44 +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
0c7e5299bf
Add squeeze_empty_lines to PrettyPrinter 2024-02-24 13:51:05 +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
David Peter
1ae9e843ed
Merge branch 'master' into skip-highlighting-when-no-color 2024-02-23 21:59:32 +01:00
David Peter
4549f83689
Merge branch 'master' into quadlet 2024-02-23 21:54:36 +01:00
David Peter
3ffa3648cf
Merge pull request #2853 from einfachIrgendwer0815/document_default_style_components
Document default style components
2024-02-23 21:51:55 +01:00
David Peter
a6f01af8de
Merge branch 'master' into containers-conf 2024-02-23 21:50:35 +01:00
David Peter
b718889ba2
Merge branch 'master' into master 2024-02-23 21:48:44 +01:00
David Peter
708c74f6af
Merge pull request #2795 from mxaddict/master
Added JSONC and aws credentials to the syntax mappings
2024-02-23 21:48:20 +01:00
David Peter
74d666f5c0
Merge branch 'master' into skip-highlighting-when-no-color 2024-02-23 21:45:38 +01:00
David Peter
7604fe5567
Merge pull request #2807 from Oliver-Looney/2783-setting-terminal-title
2783 setting terminal title
2024-02-23 21:37:28 +01:00
David Peter
0080b043c4
Merge branch 'master' into master 2024-02-23 21:35:21 +01:00
cyqsimon
2b4339663c
Builtin glob matchers build offload, v2 2024-02-21 14:56:37 +08:00
cyqsimon
6a6b02117b
Apply clippy fixes (#2864)
* Apply clippy fixes

* Write changelog
2024-02-20 19:39:22 +01:00
cyqsimon
92915e22e7
Map containers .conf files to TOML syntax 2024-02-21 00:25:06 +08:00
cyqsimon
152d69fe98
Add syntax mapping for podman quadlets 2024-02-20 14:49:12 +08:00
Oliver Looney
1f628203e5
Merge branch 'master' into 2783-setting-terminal-title 2024-02-12 09:34:01 +00:00
David Peter
bc1ca1a346
Merge branch 'master' into fix-2185 2024-02-12 08:19:56 +01:00
Ethan P.
25b5a41189
Skip syntax parsing when color output disabled 2024-02-11 22:49:49 -08:00
Ethan P.
c94cf4e14e
Split syntax highlighting from print_line into fn
This simplifies the `print_line` function a little bit while also
providing a way for syntax highlighting to be skipped when it's
not being used (i.e. `--color=never`).
2024-02-11 22:27:35 -08:00
Ethan P.
84d80eebd0
Test for correct categorization of SGR sequences
This adds a regression test for the fix in the previous commit.
2024-02-11 19:40:29 -08:00
Ethan P.
915dd9fbf8
Fix incorrect categorization of SGR sequences
Specifically, prevent other attributes from leaking into the
bold/dim/italic/underline attributes, and ensure that bright backgrounds
are put into the background attribute instead of the foreground
attribute.
2024-02-11 19:35:54 -08:00
Ethan P.
9d77c1373c
Fix off-by-one error in line number continuation 2024-02-11 16:49:06 -08:00
Oliver Looney
c3f2ddf509
Merge branch 'master' into 2783-setting-terminal-title 2024-02-11 22:53:48 +00:00
einfachIrgendwer0815
875046e4cd
Mention which style components are the default 2024-02-11 10:06:01 +01:00
mxaddict
a5bd9f51be Added JSONC and aws credentials to the syntax mappings 2024-02-11 04:57:42 +08:00
Ethan P
1023399c5e
Remove hyperlink when wrapping lines 2024-02-09 22:09:39 -08:00
Ethan P
6549e26f5d
Re-emit hyperlinks when wrapping lines 2024-02-09 22:09:39 -08:00
Ethan P
165c495e75
Replace AnsiCodeIterator in printer.rs
This uses the new EscapeSequenceIterator, saving us a preprocessing step
for each line.
2024-02-09 22:09:39 -08:00
Ethan P
6b9b085be3
Add EscapeSequenceIterator
This is an iterator for escape sequences, using
EscapeSequenceOffsetsIterator for the underlying parsing of individual
escape sequences.
2024-02-09 22:09:39 -08:00
Ethan P
054421268f
Strip OSC sequences before printing
This commit strips OSC (Operating System Command) sequences before
printing lines. Eventually when time permits, I want to add back
support for printing OSC sequences (and improve it to treat hyperlinks
like an attribute).

Until then, this should help prevent garbled output :)
2024-02-09 22:09:39 -08:00
Ethan P
414403b062
Add EscapeSequenceOffsetsIterator
This can be used to extract a subset of ANSI escape sequences from a
string of text. I have big plans for this eventually, but for now, it'll
be used to strip OSC before printing.
2024-02-09 22:09:35 -08:00
David Tolnay
1a54c9bf6d
Eliminate dependency on serde's "derive" feature 2024-02-08 15:55:30 -08:00
Oliver looney
02077db53e
undid unnecessary api visibility changes 2024-02-08 21:41:20 +00:00
Oliver looney
7ce010d9ed
Using hypens instead of underscores for set-terminal-title command 2024-02-08 21:33:03 +00:00
Andy Kipp
0af1df5258
Create xonsh.toml 2024-01-31 14:07:56 +01:00
Oliver looney
7f12989127
added set_terminal_title arg to clap_app.rs to fix ci errors 2024-01-29 09:47:41 +00:00
Oliver looney
60e32cf823
removed set_terminal_title arg from clap_app.rs since other boolean args aren't in clap_app.rs 2024-01-27 14:46:13 +00:00
Oliver looney
b33e33fe26
terminal title is only set if user opts in with --set_terminal_title flag 2024-01-27 14:17:25 +00:00
Oliver looney
9239b125b1
added a flag to config for setting terminal title 2024-01-27 14:14:40 +00:00
Filip Razek
e586751208 Attempt to fix integration test 2024-01-21 19:48:26 +01:00
Filip Razek
5c1f47359e Run cargo fmt 2024-01-21 19:48:26 +01:00
Filip Razek
45ee2dc4c7 fix: Wrap file name in header 2024-01-21 19:48:26 +01:00
cyqsimon
230abfd2bc
Merge branch 'master' into syntax-mapping-refactor 2024-01-19 15:18:48 +08:00
cyqsimon
c0f2d6f934
Add note on subdirectory's irrelevance to ordering 2024-01-18 23:26:00 +08:00
cyqsimon
e4d637a3d8
Reverse precedence of syntax mappings specified on CLI 2024-01-18 22:41:57 +08:00
rhysd
8e66bc8722 Make the error handler FnMut 2024-01-17 22:00:29 +01:00
Oliver looney
3b0ade9cb8
slightly changed set terminal command to match docs & broke print line into multiple variables 2023-12-31 22:24:44 +00:00
Oliver looney
57016f4e04
small refactoring of set terminal title function 2023-12-31 22:15:00 +00:00
Oliver looney
12b74dfb4e
terminal title is only set when pager is being used 2023-12-18 16:59:12 +00:00
cyqsimon
f0a6fe216d
Benchmark prototype 2023-12-11 10:38:59 +08:00
cyqsimon
8a08025091
Disable builtin_mappings_are_lazily_evaluated for ARM builds 2023-12-11 10:21:06 +08:00
cyqsimon
586c804b1e
Add test: builtin_mappings_are_lazily_evaluated 2023-12-11 10:21:06 +08:00
cyqsimon
e30161ac3c
Add test: builtin_mappings_matcher_only_compile_once 2023-12-11 10:21:06 +08:00
cyqsimon
3865908439
Add test: custom_mappings_precedence 2023-12-11 10:21:06 +08:00
cyqsimon
9474b4cf8b
Rename & sort syntax mapping tests 2023-12-11 10:21:06 +08:00
cyqsimon
b48bda21a3
Add test: all_fixed_builtin_mappings_can_compile 2023-12-11 10:21:06 +08:00
cyqsimon
36073a3d95
Document another rule ignore condition 2023-12-11 10:21:06 +08:00
cyqsimon
1f10d846a3
Fix tests
1. for override test, test for something in `common`
2. move git mappings to `common`
2023-12-11 10:21:05 +08:00
cyqsimon
22531eab90
Port all mappings to new system 2023-12-11 10:21:05 +08:00
cyqsimon
0c1b80faab
Impl per-target syntax mappings 2023-12-11 10:21:05 +08:00
cyqsimon
ad628c0471
Fix iterator lifetime incompatibility 2023-12-11 10:21:05 +08:00
cyqsimon
f483d2df42
Lazily compile GlobMatchers 2023-12-11 10:21:05 +08:00
cyqsimon
4ad3002543
s/Lazy<GlobMatcher>/Lazy<Option<GlobMatcher>>/ 2023-12-11 10:21:05 +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
cyqsimon
1c7c9a6b6d
Split syntax_mapping/builtin.rs 2023-12-11 10:21:05 +08:00
cyqsimon
de6d418d42
Remove BuiltinMatcher enum
Explanation added as comments in code
Using plain `Lazy<Option<GlobMatcher>>` is just better
2023-12-11 10:21:04 +08:00
cyqsimon
7e1fbcfe95
Fix visibility for SyntaxMapping::get_syntax_for
This change was made in 31fb708, but then was reverted (I assume incorrectly)
in 6246485.
2023-12-11 10:21:04 +08:00
cyqsimon
0fea82cff9
Minor improvement of variable naming accuracy 2023-12-11 10:20:11 +08:00
cyqsimon
64840fbbae
join_segments -> build_glob_string
- this is a more descriptive name
2023-12-11 10:20:11 +08:00
cyqsimon
827b3eca2f
Add unset *.conf example 2023-12-11 10:20:11 +08:00
cyqsimon
9478d2dfe8
Isolate variables at compile time 2023-12-11 10:20:11 +08:00
cyqsimon
d24501ab5e
include! generated mappings in source 2023-12-11 10:20:11 +08:00