mirror of
https://github.com/sharkdp/bat
synced 2026-07-21 16:43:19 +00:00
Run cargo fmt
This commit is contained in:
+16
-17
@@ -18,12 +18,12 @@ use ansi_term;
|
||||
|
||||
use bat::{
|
||||
assets::BAT_THEME_DEFAULT,
|
||||
config::{Config, PagingMode},
|
||||
errors::*,
|
||||
inputfile::InputFile,
|
||||
line_range::{HighlightedLineRanges, LineRange, LineRanges},
|
||||
style::{OutputComponent, OutputComponents, OutputWrap},
|
||||
syntax_mapping::SyntaxMapping,
|
||||
config::{Config, PagingMode},
|
||||
};
|
||||
|
||||
fn is_truecolor_terminal() -> bool {
|
||||
@@ -201,14 +201,13 @@ impl App {
|
||||
}
|
||||
})
|
||||
.unwrap_or_else(|| String::from(BAT_THEME_DEFAULT)),
|
||||
line_ranges:
|
||||
self.matches
|
||||
.values_of("line-range")
|
||||
.map(|vs| vs.map(LineRange::from).collect())
|
||||
.transpose()?
|
||||
.map(LineRanges::from)
|
||||
.unwrap_or_default()
|
||||
,
|
||||
line_ranges: self
|
||||
.matches
|
||||
.values_of("line-range")
|
||||
.map(|vs| vs.map(LineRange::from).collect())
|
||||
.transpose()?
|
||||
.map(LineRanges::from)
|
||||
.unwrap_or_default(),
|
||||
output_components,
|
||||
syntax_mapping,
|
||||
pager: self.matches.value_of("pager"),
|
||||
@@ -216,14 +215,14 @@ impl App {
|
||||
Some("always") => true,
|
||||
_ => false,
|
||||
},
|
||||
highlighted_lines:
|
||||
self.matches
|
||||
.values_of("highlight-line")
|
||||
.map(|ws| ws.map(LineRange::from).collect())
|
||||
.transpose()?
|
||||
.map(LineRanges::from)
|
||||
.map(|lr| HighlightedLineRanges(lr))
|
||||
.unwrap_or_default()
|
||||
highlighted_lines: self
|
||||
.matches
|
||||
.values_of("highlight-line")
|
||||
.map(|ws| ws.map(LineRange::from).collect())
|
||||
.transpose()?
|
||||
.map(LineRanges::from)
|
||||
.map(|lr| HighlightedLineRanges(lr))
|
||||
.unwrap_or_default(),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -33,5 +33,6 @@ pub fn clear_assets() {
|
||||
}
|
||||
|
||||
pub fn assets_from_cache_or_binary() -> HighlightingAssets {
|
||||
HighlightingAssets::from_cache(&theme_set_path(), &syntax_set_path()).unwrap_or(HighlightingAssets::from_binary())
|
||||
HighlightingAssets::from_cache(&theme_set_path(), &syntax_set_path())
|
||||
.unwrap_or(HighlightingAssets::from_binary())
|
||||
}
|
||||
|
||||
+12
-6
@@ -7,10 +7,10 @@ extern crate clap;
|
||||
extern crate dirs as dirs_rs;
|
||||
|
||||
mod app;
|
||||
mod assets;
|
||||
mod clap_app;
|
||||
mod config;
|
||||
mod directories;
|
||||
mod assets;
|
||||
|
||||
use std::collections::HashSet;
|
||||
use std::ffi::OsStr;
|
||||
@@ -23,22 +23,28 @@ use ansi_term::Colour::Green;
|
||||
use ansi_term::Style;
|
||||
|
||||
use crate::{app::App, config::config_file};
|
||||
use directories::PROJECT_DIRS;
|
||||
use assets::{cache_dir, clear_assets, config_dir, assets_from_cache_or_binary};
|
||||
use assets::{assets_from_cache_or_binary, cache_dir, clear_assets, config_dir};
|
||||
use bat::controller::Controller;
|
||||
use directories::PROJECT_DIRS;
|
||||
|
||||
use bat::{
|
||||
assets::HighlightingAssets,
|
||||
config::Config,
|
||||
errors::*,
|
||||
inputfile::InputFile,
|
||||
style::{OutputComponent, OutputComponents},
|
||||
config::Config,
|
||||
};
|
||||
|
||||
fn run_cache_subcommand(matches: &clap::ArgMatches) -> Result<()> {
|
||||
if matches.is_present("build") {
|
||||
let source_dir = matches.value_of("source").map(Path::new).unwrap_or_else(|| PROJECT_DIRS.config_dir());
|
||||
let target_dir = matches.value_of("target").map(Path::new).unwrap_or_else(|| PROJECT_DIRS.cache_dir());
|
||||
let source_dir = matches
|
||||
.value_of("source")
|
||||
.map(Path::new)
|
||||
.unwrap_or_else(|| PROJECT_DIRS.config_dir());
|
||||
let target_dir = matches
|
||||
.value_of("target")
|
||||
.map(Path::new)
|
||||
.unwrap_or_else(|| PROJECT_DIRS.cache_dir());
|
||||
|
||||
let blank = matches.is_present("blank");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user