1
0
mirror of https://github.com/sharkdp/bat synced 2026-08-04 19:01:44 +00:00

Move transpose to util module

This commit is contained in:
sharkdp
2018-10-11 22:27:42 +02:00
committed by David Peter
parent 9e7da05459
commit 5af176c94f
3 changed files with 29 additions and 6 deletions
+1 -6
View File
@@ -20,6 +20,7 @@ use errors::*;
use inputfile::InputFile;
use line_range::LineRange;
use style::{OutputComponent, OutputComponents, OutputWrap};
use util::transpose;
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum PagingMode {
@@ -74,12 +75,6 @@ fn is_truecolor_terminal() -> bool {
.unwrap_or(false)
}
/// Helper function that might appear in Rust stable at some point
/// (https://doc.rust-lang.org/stable/std/option/enum.Option.html#method.transpose)
fn transpose<T>(opt: Option<Result<T>>) -> Result<Option<T>> {
opt.map_or(Ok(None), |res| res.map(Some))
}
pub struct App {
pub matches: ArgMatches<'static>,
interactive_output: bool,