on master help sign in
Move back printer.rs and others into lib

others: bin/bat/{controller,decorations,output,printer}.rs

commite5426211250c907442717c566a13d38d52d4524d authorFahmi Akbar Wildana <f.a.wildana@gmail.com> dateSun 6 Oct 2019, 08:44 (7 years ago) parent26439b4
6 files changed+26−32
src/bin/bat/main.rs+2−5 src/bin/bat/controller.rs → src/controller.rs+7−12 src/bin/bat/decorations.rs → src/decorations.rs+1−1 src/lib.rs+5−1 src/bin/bat/output.rs → src/output.rs+2−1 src/bin/bat/printer.rs → src/printer.rs+9−12
src/bin/bat/main.rs+2−5
@@ -7,10 +7,6 @@ extern crate clap;
77mod app;
88mod clap_app;
99mod config;
10−mod controller;
11−mod decorations;
12−mod output;
13−mod printer;
1410
1511use std::collections::HashSet;
1612use std::io;
@@ -21,7 +17,8 @@ use std::process;
2117use ansi_term::Colour::Green;
2218use ansi_term::Style;
2319
24−use crate::{app::App, config::config_file, controller::Controller};
20+use crate::{app::App, config::config_file};
21+use bat::controller::Controller;
2522
2623use bat::{
2724 assets::{cache_dir, clear_assets, config_dir, HighlightingAssets},
src/bin/bat/controller.rs → src/controller.rsrenamed+7−12
@@ -1,18 +1,13 @@
11use std::io::{self, Write};
22use std::path::Path;
33
4−use crate::{
5− output::OutputType,
6− printer::{InteractivePrinter, Printer, SimplePrinter},
7−};
8−
9−use bat::{
10− assets::HighlightingAssets,
11− errors::*,
12− inputfile::{InputFile, InputFileReader},
13− line_range::{LineRanges, RangeCheckResult},
14− Config, PagingMode,
15−};
4+use crate::{Config, PagingMode};
5+use crate::assets::HighlightingAssets;
6+use crate::errors::*;
7+use crate::inputfile::{InputFile, InputFileReader};
8+use crate::line_range::{LineRanges, RangeCheckResult};
9+use crate::output::OutputType;
10+use crate::printer::{InteractivePrinter, Printer, SimplePrinter};
1611
1712pub struct Controller<'a> {
1813 config: &'a Config<'a>,
src/bin/bat/decorations.rs → src/decorations.rsrenamed+1−1
@@ -1,4 +1,4 @@
1−use bat::diff::LineChange;
1+use crate::diff::LineChange;
22use crate::printer::{Colors, InteractivePrinter};
33use ansi_term::Style;
44
src/lib.rs+5−1
@@ -19,11 +19,15 @@ extern crate syntect;
1919extern crate wild;
2020
2121pub mod assets;
22+pub mod controller;
23+pub mod decorations;
2224pub mod diff;
2325pub mod dirs;
2426pub mod inputfile;
2527pub mod line_range;
28+pub mod output;
2629pub mod preprocessor;
30+pub mod printer;
2731pub mod style;
2832pub mod syntax_mapping;
2933pub mod terminal;
@@ -119,4 +123,4 @@ pub struct Config<'a> {
119123
120124 /// Lines to highlight
121125 pub highlight_lines: Vec<usize>,
122−}
126+}
src/bin/bat/output.rs → src/output.rsrenamed+2−1
@@ -6,7 +6,8 @@ use std::process::{Child, Command, Stdio};
66
77use shell_words;
88
9−use bat::{errors::*, PagingMode};
9+use crate::PagingMode;
10+use crate::errors::*;
1011
1112pub enum OutputType {
1213 Pager(Child),
src/bin/bat/printer.rs → src/printer.rsrenamed+9−12
@@ -16,21 +16,18 @@ use content_inspector::ContentType;
1616use encoding::all::{UTF_16BE, UTF_16LE};
1717use encoding::{DecoderTrap, Encoding};
1818
19+use crate::Config;
20+use crate::assets::HighlightingAssets;
1921use crate::decorations::{
2022 Decoration, GridBorderDecoration, LineChangesDecoration, LineNumberDecoration,
2123};
22−
23−use bat::{
24− assets::HighlightingAssets,
25− diff::get_git_diff,
26− diff::LineChanges,
27− errors::*,
28− inputfile::{InputFile, InputFileReader},
29− preprocessor::{expand_tabs, replace_nonprintable},
30− style::OutputWrap,
31− terminal::{as_terminal_escaped, to_ansi_color},
32− Config,
33−};
24+use crate::diff::get_git_diff;
25+use crate::diff::LineChanges;
26+use crate::errors::*;
27+use crate::inputfile::{InputFile, InputFileReader};
28+use crate::preprocessor::{expand_tabs, replace_nonprintable};
29+use crate::style::OutputWrap;
30+use crate::terminal::{as_terminal_escaped, to_ansi_color};
3431
3532pub trait Printer {
3633 fn print_header(&mut self, handle: &mut dyn Write, file: InputFile) -> Result<()>;