mirror of
https://github.com/sharkdp/bat.git
synced 2024-11-26 17:53:54 +01:00
Move back printer.rs and others into lib
others: bin/bat/{controller,decorations,output,printer}.rs
This commit is contained in:
parent
26439b41d2
commit
e542621125
@ -7,10 +7,6 @@ extern crate clap;
|
||||
mod app;
|
||||
mod clap_app;
|
||||
mod config;
|
||||
mod controller;
|
||||
mod decorations;
|
||||
mod output;
|
||||
mod printer;
|
||||
|
||||
use std::collections::HashSet;
|
||||
use std::io;
|
||||
@ -21,7 +17,8 @@ use std::process;
|
||||
use ansi_term::Colour::Green;
|
||||
use ansi_term::Style;
|
||||
|
||||
use crate::{app::App, config::config_file, controller::Controller};
|
||||
use crate::{app::App, config::config_file};
|
||||
use bat::controller::Controller;
|
||||
|
||||
use bat::{
|
||||
assets::{cache_dir, clear_assets, config_dir, HighlightingAssets},
|
||||
|
@ -1,18 +1,13 @@
|
||||
use std::io::{self, Write};
|
||||
use std::path::Path;
|
||||
|
||||
use crate::{
|
||||
output::OutputType,
|
||||
printer::{InteractivePrinter, Printer, SimplePrinter},
|
||||
};
|
||||
|
||||
use bat::{
|
||||
assets::HighlightingAssets,
|
||||
errors::*,
|
||||
inputfile::{InputFile, InputFileReader},
|
||||
line_range::{LineRanges, RangeCheckResult},
|
||||
Config, PagingMode,
|
||||
};
|
||||
use crate::{Config, PagingMode};
|
||||
use crate::assets::HighlightingAssets;
|
||||
use crate::errors::*;
|
||||
use crate::inputfile::{InputFile, InputFileReader};
|
||||
use crate::line_range::{LineRanges, RangeCheckResult};
|
||||
use crate::output::OutputType;
|
||||
use crate::printer::{InteractivePrinter, Printer, SimplePrinter};
|
||||
|
||||
pub struct Controller<'a> {
|
||||
config: &'a Config<'a>,
|
@ -1,4 +1,4 @@
|
||||
use bat::diff::LineChange;
|
||||
use crate::diff::LineChange;
|
||||
use crate::printer::{Colors, InteractivePrinter};
|
||||
use ansi_term::Style;
|
||||
|
@ -19,11 +19,15 @@ extern crate syntect;
|
||||
extern crate wild;
|
||||
|
||||
pub mod assets;
|
||||
pub mod controller;
|
||||
pub mod decorations;
|
||||
pub mod diff;
|
||||
pub mod dirs;
|
||||
pub mod inputfile;
|
||||
pub mod line_range;
|
||||
pub mod output;
|
||||
pub mod preprocessor;
|
||||
pub mod printer;
|
||||
pub mod style;
|
||||
pub mod syntax_mapping;
|
||||
pub mod terminal;
|
||||
|
@ -6,7 +6,8 @@ use std::process::{Child, Command, Stdio};
|
||||
|
||||
use shell_words;
|
||||
|
||||
use bat::{errors::*, PagingMode};
|
||||
use crate::PagingMode;
|
||||
use crate::errors::*;
|
||||
|
||||
pub enum OutputType {
|
||||
Pager(Child),
|
@ -16,21 +16,18 @@ use content_inspector::ContentType;
|
||||
use encoding::all::{UTF_16BE, UTF_16LE};
|
||||
use encoding::{DecoderTrap, Encoding};
|
||||
|
||||
use crate::Config;
|
||||
use crate::assets::HighlightingAssets;
|
||||
use crate::decorations::{
|
||||
Decoration, GridBorderDecoration, LineChangesDecoration, LineNumberDecoration,
|
||||
};
|
||||
|
||||
use bat::{
|
||||
assets::HighlightingAssets,
|
||||
diff::get_git_diff,
|
||||
diff::LineChanges,
|
||||
errors::*,
|
||||
inputfile::{InputFile, InputFileReader},
|
||||
preprocessor::{expand_tabs, replace_nonprintable},
|
||||
style::OutputWrap,
|
||||
terminal::{as_terminal_escaped, to_ansi_color},
|
||||
Config,
|
||||
};
|
||||
use crate::diff::get_git_diff;
|
||||
use crate::diff::LineChanges;
|
||||
use crate::errors::*;
|
||||
use crate::inputfile::{InputFile, InputFileReader};
|
||||
use crate::preprocessor::{expand_tabs, replace_nonprintable};
|
||||
use crate::style::OutputWrap;
|
||||
use crate::terminal::{as_terminal_escaped, to_ansi_color};
|
||||
|
||||
pub trait Printer {
|
||||
fn print_header(&mut self, handle: &mut dyn Write, file: InputFile) -> Result<()>;
|
Loading…
Reference in New Issue
Block a user