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