Commit Graph

164 Commits

Author SHA1 Message Date
sharkdp
e2ac6de783 Fix clippy warnings 2018-05-10 13:15:59 +02:00
Ezinwa Okpoechi
25cee002f9 Split modules (#86)
* Split diffing to separate module
* Split assets to separate module
2018-05-10 12:36:09 +02:00
sharkdp
ea27053a63 Remove unused lifetimes 2018-05-10 12:20:38 +02:00
Pit Kleyersburg
b2b932f3ed Fix header-line if grid is not requested 2018-05-10 12:20:38 +02:00
Pit Kleyersburg
747d074be1 Replace Cow by String 2018-05-10 12:20:38 +02:00
Pit Kleyersburg
61109ece15 Create OutputComponents struct, use HashSet 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
Connor Kuehl
49223eed06 Remove term_width from Printer, its options owns it. 2018-05-08 22:57:29 +02:00
Connor Kuehl
7dc7133b3c Add revisions for line-wrapping and terminal width.
* Adds separator.length() to calculation for desired width.
* Replaces use of term_width with options.term_width.
* Adds the comma and space separator to calculation for line-wrapping.
2018-05-08 22:57:29 +02:00
Connor Kuehl
e5e47716b0 Add term_width to options struct, move getting term_width to run() 2018-05-08 22:57:29 +02:00
sharkdp
9a0e444e09 Simplify stdout handling 2018-05-07 23:27:38 +02:00
sharkdp
438f3df345 Paint STDOUT bold, unify writeln statement 2018-05-07 23:27:38 +02:00
sharkdp
7e2e0c82ac Add support for reading from stdin, closes #2 2018-05-07 23:27:38 +02:00
Ezinwa Okpoechi
53d67e2b6e Add printer
This adds a separate struct that handles printing of the different
tokens.
2018-05-07 08:57:21 +02:00