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.)
This commit is contained in:
Pit Kleyersburg authored and David Peter committed 2018-05-10 12:20:38 +02:00
1 parent fdeb98e859
commit 23813cc08b
4 files changed
+239 -76

No files matched your search

+1
View File
@@ -13,6 +13,7 @@ version = "0.3.0"
atty = "0.2.2"
ansi_term = "0.10"
console = "0.6"
either = "1.4"
error-chain = "0.11"
directories = "0.10"
lazy_static = "1.0"