Commit Graph

463 Commits

Author SHA1 Message Date
Pit Kleyersburg
389edd7239 Combine OutputComponents and PredefinedStyles
This commit tries to simply the change. Instead of separating an
`OutputComponent` and a `PredefinedStyle`, I have combined the two into
just `OutputComponent`.

To still have the styles work, I added an impl to `OutputComponent` with
a function `components` which returns the components related to the
specified component.

For a simple output component this is trivial, but for the predefined
styles this is a list of other components.

The evaluating of the command-line parameter simplified significantly,
making use of Claps `values_t!` macro to parse the supplied parameters
into a `Vec<OutputComponent>`. After that it is simply a task of
combining all supplied output components into one vector.

Important: this means that the styles are now additive, rather than one
of the predefined styles overruling other parameters supplied.
2018-05-10 12:20:38 +02:00
Pit Kleyersburg
23813cc08b Make --style parameter more flexible
The `--style` parameter now accepts a comma-separated list of strings,
where every element defines either a single output component (`changes`,
`grid`, `header`, `numbers`) or a predefined style (`full`,
`line-numbers`, `plain`).

If available, bat picks the first predefined style in the user-supplied
style-list and ignores everything else. If no predefined style was
requested, the other parameters that are simple output components will
be used.

Examples:

    --style changes,full,numbers

  Will internally be reduced to only the predefined style `full`.

    --style plain,full

  Will internally be reduced to only the predefined style `plain`.

    --style changes,numbers

  Will not be reduced, because the list does not contain any predefined
  styles.

(Note: if `grid` is requested but no other parameters, bat still creates
the left-most column with a width of `PANEL_WIDTH`. I didn't want to
introduce further logic in this PR that drops or adapts the width of the
left column.)
2018-05-10 12:20:38 +02:00
sharkdp
f59ddd1e36 Update dependencies 2018-05-08 23:49:07 +02:00
sharkdp
4e8ea815af Bump version 2018-05-03 09:07:58 +02:00
sharkdp
edbe8f3e1a Remove openssl dependency 2018-05-02 20:45:07 +02:00
sharkdp
ed09a80a73 Bump version to 0.2.1 2018-05-01 12:46:33 +02:00
sharkdp
25f83610f9 Remove explicit bincode dependency 2018-04-30 20:11:21 +02:00
sharkdp
64ef61b409 Add customization chapter 2018-04-30 16:03:39 +02:00
sharkdp
f81e38618c Implement SyntaxSet and ThemeSet caching
closes #21, see #20
2018-04-30 15:09:20 +02:00
sharkdp
74d023a7b1 Specify syntect features 2018-04-30 13:01:29 +02:00
sharkdp
36bbc770eb Use error-chain 2018-04-30 11:09:24 +02:00
sharkdp
a979608f37 Add Git support, closes #8 2018-04-21 17:12:25 +02:00
sharkdp
8f5a80ea07 Initial commit 2018-04-21 12:53:24 +02:00