Move InputFile to separate module

This commit is contained in:
sharkdp 2018-10-07 11:21:41 +02:00 committed by David Peter
parent 1be346a038
commit 860f3e9006
6 changed files with 15 additions and 11 deletions

View File

@ -15,6 +15,7 @@ use ansi_term;
use assets::BAT_THEME_DEFAULT;
use errors::*;
use inputfile::InputFile;
use line_range::LineRange;
use style::{OutputComponent, OutputComponents, OutputWrap};
@ -25,13 +26,6 @@ pub enum PagingMode {
Never,
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum InputFile<'a> {
StdIn,
Ordinary(&'a str),
ThemePreviewFile,
}
#[derive(Clone)]
pub struct Config<'a> {
/// List of files to print

View File

@ -11,7 +11,7 @@ use syntect::parsing::{SyntaxDefinition, SyntaxSet};
#[cfg(unix)]
use std::os::unix::fs::FileTypeExt;
use app::InputFile;
use inputfile::InputFile;
lazy_static! {
static ref PROJECT_DIRS: ProjectDirs =

View File

@ -1,9 +1,10 @@
use std::fs::File;
use std::io::{self, BufRead, BufReader, Write};
use app::{Config, InputFile};
use app::Config;
use assets::HighlightingAssets;
use errors::*;
use inputfile::InputFile;
use line_range::LineRange;
use output::OutputType;
use printer::{InteractivePrinter, Printer, SimplePrinter};

6
src/inputfile.rs Normal file
View File

@ -0,0 +1,6 @@
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum InputFile<'a> {
StdIn,
Ordinary(&'a str),
ThemePreviewFile,
}

View File

@ -24,6 +24,7 @@ mod clap_app;
mod controller;
mod decorations;
mod diff;
mod inputfile;
mod line_range;
mod output;
mod preprocessor;
@ -40,9 +41,10 @@ use std::process;
use ansi_term::Colour::Green;
use ansi_term::Style;
use app::{App, Config, InputFile};
use app::{App, Config};
use assets::{clear_assets, config_dir, HighlightingAssets};
use controller::Controller;
use inputfile::InputFile;
use style::{OutputComponent, OutputComponents};
mod errors {

View File

@ -10,12 +10,13 @@ use console::AnsiCodeIterator;
use syntect::easy::HighlightLines;
use syntect::highlighting::Theme;
use app::{Config, InputFile};
use app::Config;
use assets::HighlightingAssets;
use decorations::{Decoration, GridBorderDecoration, LineChangesDecoration, LineNumberDecoration};
use diff::get_git_diff;
use diff::LineChanges;
use errors::*;
use inputfile::InputFile;
use preprocessor::expand;
use style::OutputWrap;
use terminal::{as_terminal_escaped, to_ansi_color};