Move InputFile to separate module

pull/337/head
sharkdp 6 years ago committed by David Peter
parent 1be346a038
commit 860f3e9006

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

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

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

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

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

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

Loading…
Cancel
Save