diff --git a/src/bin/bat/main.rs b/src/bin/bat/main.rs index f8eb9805..1176c7d4 100644 --- a/src/bin/bat/main.rs +++ b/src/bin/bat/main.rs @@ -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}, diff --git a/src/bin/bat/controller.rs b/src/controller.rs similarity index 93% rename from src/bin/bat/controller.rs rename to src/controller.rs index dae0667b..9208433c 100644 --- a/src/bin/bat/controller.rs +++ b/src/controller.rs @@ -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>, diff --git a/src/bin/bat/decorations.rs b/src/decorations.rs similarity index 99% rename from src/bin/bat/decorations.rs rename to src/decorations.rs index 3ffbed64..7654c617 100644 --- a/src/bin/bat/decorations.rs +++ b/src/decorations.rs @@ -1,4 +1,4 @@ -use bat::diff::LineChange; +use crate::diff::LineChange; use crate::printer::{Colors, InteractivePrinter}; use ansi_term::Style; diff --git a/src/lib.rs b/src/lib.rs index 99e17f19..553cd3a5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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; @@ -119,4 +123,4 @@ pub struct Config<'a> { /// Lines to highlight pub highlight_lines: Vec, -} \ No newline at end of file +} diff --git a/src/bin/bat/output.rs b/src/output.rs similarity index 98% rename from src/bin/bat/output.rs rename to src/output.rs index 58b9e416..d98f97d4 100644 --- a/src/bin/bat/output.rs +++ b/src/output.rs @@ -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), diff --git a/src/bin/bat/printer.rs b/src/printer.rs similarity index 98% rename from src/bin/bat/printer.rs rename to src/printer.rs index cf74d220..3f018625 100644 --- a/src/bin/bat/printer.rs +++ b/src/printer.rs @@ -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<()>;