summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFahmi Akbar Wildana <f.a.wildana@gmail.com>2019-10-06 08:44:14 +0700
committerDavid Peter <sharkdp@users.noreply.github.com>2019-10-20 21:43:51 +0200
commite5426211250c907442717c566a13d38d52d4524d (patch)
tree18809108f656e8771ed53bf32ac9082ed8f35cc2 /src
parent26439b41d2b5a7d68f8e6fe22ccd1299bd7c5ccc (diff)
Move back printer.rs and others into lib
others: bin/bat/{controller,decorations,output,printer}.rs
Diffstat (limited to 'src')
-rw-r--r--src/bin/bat/main.rs7
-rw-r--r--src/controller.rs (renamed from src/bin/bat/controller.rs)19
-rw-r--r--src/decorations.rs (renamed from src/bin/bat/decorations.rs)2
-rw-r--r--src/lib.rs6
-rw-r--r--src/output.rs (renamed from src/bin/bat/output.rs)3
-rw-r--r--src/printer.rs (renamed from src/bin/bat/printer.rs)21
6 files changed, 26 insertions, 32 deletions
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
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
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<usize>,
-} \ No newline at end of file
+}
diff --git a/src/bin/bat/output.rs b/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
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<()>;