mirror of
https://github.com/sharkdp/bat.git
synced 2025-02-22 12:58:26 +00:00
Auto-format Rust code
This commit is contained in:
parent
de47bd2323
commit
b3903175c8
@ -44,8 +44,7 @@ pub fn generate_config_file() -> bat::error::Result<()> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let default_config =
|
let default_config = r#"# This is `bat`s configuration file. Each line either contains a comment or
|
||||||
r#"# This is `bat`s configuration file. Each line either contains a comment or
|
|
||||||
# a command-line option that you want to pass to `bat` by default. You can
|
# a command-line option that you want to pass to `bat` by default. You can
|
||||||
# run `bat --help` to get a list of all possible configuration options.
|
# run `bat --help` to get a list of all possible configuration options.
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@ use crate::paging::PagingMode;
|
|||||||
#[cfg(feature = "paging")]
|
#[cfg(feature = "paging")]
|
||||||
use crate::wrapping::WrappingMode;
|
use crate::wrapping::WrappingMode;
|
||||||
|
|
||||||
|
|
||||||
#[cfg(feature = "paging")]
|
#[cfg(feature = "paging")]
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
enum SingleScreenAction {
|
enum SingleScreenAction {
|
||||||
@ -18,7 +17,6 @@ enum SingleScreenAction {
|
|||||||
Nothing,
|
Nothing,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum OutputType {
|
pub enum OutputType {
|
||||||
#[cfg(feature = "paging")]
|
#[cfg(feature = "paging")]
|
||||||
@ -28,11 +26,17 @@ pub enum OutputType {
|
|||||||
|
|
||||||
impl OutputType {
|
impl OutputType {
|
||||||
#[cfg(feature = "paging")]
|
#[cfg(feature = "paging")]
|
||||||
pub fn from_mode(paging_mode: PagingMode, wrapping_mode: WrappingMode, pager: Option<&str>) -> Result<Self> {
|
pub fn from_mode(
|
||||||
|
paging_mode: PagingMode,
|
||||||
|
wrapping_mode: WrappingMode,
|
||||||
|
pager: Option<&str>,
|
||||||
|
) -> Result<Self> {
|
||||||
use self::PagingMode::*;
|
use self::PagingMode::*;
|
||||||
Ok(match paging_mode {
|
Ok(match paging_mode {
|
||||||
Always => OutputType::try_pager(SingleScreenAction::Nothing, wrapping_mode, pager)?,
|
Always => OutputType::try_pager(SingleScreenAction::Nothing, wrapping_mode, pager)?,
|
||||||
QuitIfOneScreen => OutputType::try_pager(SingleScreenAction::Quit, wrapping_mode, pager)?,
|
QuitIfOneScreen => {
|
||||||
|
OutputType::try_pager(SingleScreenAction::Quit, wrapping_mode, pager)?
|
||||||
|
}
|
||||||
_ => OutputType::stdout(),
|
_ => OutputType::stdout(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -42,7 +46,7 @@ impl OutputType {
|
|||||||
fn try_pager(
|
fn try_pager(
|
||||||
single_screen_action: SingleScreenAction,
|
single_screen_action: SingleScreenAction,
|
||||||
wrapping_mode: WrappingMode,
|
wrapping_mode: WrappingMode,
|
||||||
pager_from_config: Option<&str>
|
pager_from_config: Option<&str>,
|
||||||
) -> Result<Self> {
|
) -> Result<Self> {
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::ffi::OsString;
|
use std::ffi::OsString;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user