| 1 | use craterust-analyzer cargo git-delta 0.19.2 crate/::clirust-analyzer cargo git-delta 0.19.2 cli/; |
| 2 | use craterust-analyzer cargo git-delta 0.19.2 crate/::colorrust-analyzer cargo git-delta 0.19.2 color/; |
| 3 | use craterust-analyzer cargo git-delta 0.19.2 crate/::colorsrust-analyzer cargo git-delta 0.19.2 colors/; |
| 4 | use craterust-analyzer cargo git-delta 0.19.2 crate/::configrust-analyzer cargo git-delta 0.19.2 config/; |
| 5 | use craterust-analyzer cargo git-delta 0.19.2 crate/::deltarust-analyzer cargo git-delta 0.19.2 delta/; |
| 6 | use craterust-analyzer cargo git-delta 0.19.2 crate/::envrust-analyzer cargo git-delta 0.19.2 env/::DeltaEnvrust-analyzer cargo git-delta 0.19.2 env/DeltaEnv#; |
| 7 | use craterust-analyzer cargo git-delta 0.19.2 crate/::paintrust-analyzer cargo git-delta 0.19.2 paint/; |
| 8 | use craterust-analyzer cargo git-delta 0.19.2 crate/::paintrust-analyzer cargo git-delta 0.19.2 paint/::BgShouldFillrust-analyzer cargo git-delta 0.19.2 paint/BgShouldFill#; |
| 9 | use craterust-analyzer cargo git-delta 0.19.2 crate/::stylerust-analyzer cargo git-delta 0.19.2 style/; |
| 10 | use craterust-analyzer cargo git-delta 0.19.2 crate/::utilsrust-analyzer cargo git-delta 0.19.2 utils/::batrust-analyzer cargo git-delta 0.19.2 utils/bat/::outputrust-analyzer cargo git-delta 0.19.2 utils/bat/output/::{OutputTyperust-analyzer cargo git-delta 0.19.2 utils/bat/output/OutputType#, PagingModerust-analyzer cargo git-delta 0.19.2 utils/bat/output/PagingMode#}; |
| 11 | |
| 12 | #[cfg(not(tarpaulin_include))] |
| 13 | pub fn show_colorsrust-analyzer cargo git-delta 0.19.2 subcommands/show_colors/show_colors().() -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<()> { |
| 14 | use craterust-analyzer cargo git-delta 0.19.2 crate/::{deltarust-analyzer cargo git-delta 0.19.2 delta/::DiffTyperust-analyzer cargo git-delta 0.19.2 delta/DiffType#, utilsrust-analyzer cargo git-delta 0.19.2 utils/}; |
| 15 | |
| 16 | let args = stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::args_osrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/args_os().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(); |
| 17 | let env = DeltaEnvrust-analyzer cargo git-delta 0.19.2 env/DeltaEnv#::defaultrust-analyzer cargo git-delta 0.19.2 env/impl#[DeltaEnv][Default]default().(); |
| 18 | let assets = utilsrust-analyzer cargo git-delta 0.19.2 utils/::batrust-analyzer cargo git-delta 0.19.2 utils/bat/::assetsrust-analyzer cargo git-delta 0.19.2 utils/bat/assets/::load_highlighting_assetsrust-analyzer cargo git-delta 0.19.2 utils/bat/assets/load_highlighting_assets().(); |
| 19 | |
| 20 | let opt = match clirust-analyzer cargo git-delta 0.19.2 cli/::Optrust-analyzer cargo git-delta 0.19.2 cli/Opt#::from_args_and_git_configrust-analyzer cargo git-delta 0.19.2 cli/impl#[Opt]from_args_and_git_config().(args, &env, assets) { |
| 21 | (clirust-analyzer cargo git-delta 0.19.2 cli/::Callrust-analyzer cargo git-delta 0.19.2 cli/Call#::Deltarust-analyzer cargo git-delta 0.19.2 cli/Call#Delta#(_), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(opt)) => opt, |
| 22 | _ => panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("non-Delta Call variant should not occur here"), |
| 23 | }; |
| 24 | |
| 25 | let config = configrust-analyzer cargo git-delta 0.19.2 config/::Configrust-analyzer cargo git-delta 0.19.2 config/Config#::fromrust-analyzer cargo git-delta 0.19.2 config/impl#[Config][`From<cli::Opt>`]from().(opt); |
| 26 | let pagercfg = (&config).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 27 | |
| 28 | let mut output_type = |
| 29 | OutputTyperust-analyzer cargo git-delta 0.19.2 utils/bat/output/OutputType#::from_moderust-analyzer cargo git-delta 0.19.2 utils/bat/output/impl#[OutputType]from_mode().(&env, PagingModerust-analyzer cargo git-delta 0.19.2 utils/bat/output/PagingMode#::QuitIfOneScreenrust-analyzer cargo git-delta 0.19.2 utils/bat/output/PagingMode#QuitIfOneScreen#, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, &pagercfg).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 30 | let writer = output_type.handlerust-analyzer cargo git-delta 0.19.2 utils/bat/output/impl#[OutputType]handle().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 31 | |
| 32 | let mut painter = paintrust-analyzer cargo git-delta 0.19.2 paint/::Painterrust-analyzer cargo git-delta 0.19.2 paint/Painter#::newrust-analyzer cargo git-delta 0.19.2 paint/impl#[`Painter<'p>`]new().(writer, &config); |
| 33 | painter.set_syntaxrust-analyzer cargo git-delta 0.19.2 paint/impl#[`Painter<'p>`]set_syntax().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("a.ts")); |
| 34 | painter.set_highlighterrust-analyzer cargo git-delta 0.19.2 paint/impl#[`Painter<'p>`]set_highlighter().(); |
| 35 | |
| 36 | let title_style = ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style#::newrust-analyzer cargo nu-ansi-term 0.50.3 style/impl#[Style]new().().boldrust-analyzer cargo nu-ansi-term 0.50.3 style/impl#[Style]bold().(); |
| 37 | let mut style = stylerust-analyzer cargo git-delta 0.19.2 style/::Stylerust-analyzer cargo git-delta 0.19.2 style/Style# { |
| 38 | is_syntax_highlightedrust-analyzer cargo git-delta 0.19.2 style/Style#is_syntax_highlighted.: true, |
| 39 | ..stylerust-analyzer cargo git-delta 0.19.2 style/::Stylerust-analyzer cargo git-delta 0.19.2 style/Style#::defaultrust-analyzer cargo git-delta 0.19.2 style/impl#[Style][Default]default().() |
| 40 | }; |
| 41 | for (group, color_names) in colorsrust-analyzer cargo git-delta 0.19.2 colors/::color_groupsrust-analyzer cargo git-delta 0.19.2 colors/color_groups().() { |
| 42 | writelnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/writeln!!(painter.writerrust-analyzer cargo git-delta 0.19.2 paint/Painter#writer., "\n\n{}\n", title_style.paintrust-analyzer cargo nu-ansi-term 0.50.3 display/impl#[Style]paint().(group))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 43 | for (color_name, hex) in color_names { |
| 44 | // Two syntax-highlighted lines without background color |
| 45 | style.ansi_term_stylerust-analyzer cargo git-delta 0.19.2 style/Style#ansi_term_style..backgroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#background. = Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 46 | for line in [ |
| 47 | r#"export function color(): string {{ return "none" }}"#, |
| 48 | r#"export function hex(): string {{ return "none" }}"#, |
| 49 | ] { |
| 50 | painter.syntax_highlight_and_paint_linerust-analyzer cargo git-delta 0.19.2 paint/impl#[`Painter<'p>`]syntax_highlight_and_paint_line().( |
| 51 | line, |
| 52 | paintrust-analyzer cargo git-delta 0.19.2 paint/::StyleSectionSpecifierrust-analyzer cargo git-delta 0.19.2 paint/StyleSectionSpecifier#::Stylerust-analyzer cargo git-delta 0.19.2 paint/StyleSectionSpecifier#Style#(style), |
| 53 | deltarust-analyzer cargo git-delta 0.19.2 delta/::Staterust-analyzer cargo git-delta 0.19.2 delta/State#::HunkZerorust-analyzer cargo git-delta 0.19.2 delta/State#HunkZero#(DiffTyperust-analyzer cargo git-delta 0.19.2 delta/DiffType#::Unifiedrust-analyzer cargo git-delta 0.19.2 delta/DiffType#Unified#, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#), |
| 54 | BgShouldFillrust-analyzer cargo git-delta 0.19.2 paint/BgShouldFill#::defaultrust-analyzer cargo git-delta 0.19.2 paint/impl#[BgShouldFill][Default]default().(), |
| 55 | ) |
| 56 | } |
| 57 | // Two syntax-highlighted lines with background color |
| 58 | let color = |
| 59 | colorrust-analyzer cargo git-delta 0.19.2 color/::parse_colorrust-analyzer cargo git-delta 0.19.2 color/parse_color().(color_name, config.true_colorrust-analyzer cargo git-delta 0.19.2 config/Config#true_color., config.git_configrust-analyzer cargo git-delta 0.19.2 config/impl#[Config]git_config().()).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 60 | style.ansi_term_stylerust-analyzer cargo git-delta 0.19.2 style/Style#ansi_term_style..backgroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#background. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(color); |
| 61 | for line in [ |
| 62 | &formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!(r#"export function color(): string {{ return "{color_name}" }}"#), |
| 63 | &formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!(r#"export function hex(): string {{ return "{hex}" }}"#), |
| 64 | ] { |
| 65 | painter.syntax_highlight_and_paint_linerust-analyzer cargo git-delta 0.19.2 paint/impl#[`Painter<'p>`]syntax_highlight_and_paint_line().( |
| 66 | line, |
| 67 | paintrust-analyzer cargo git-delta 0.19.2 paint/::StyleSectionSpecifierrust-analyzer cargo git-delta 0.19.2 paint/StyleSectionSpecifier#::Stylerust-analyzer cargo git-delta 0.19.2 paint/StyleSectionSpecifier#Style#(style), |
| 68 | deltarust-analyzer cargo git-delta 0.19.2 delta/::Staterust-analyzer cargo git-delta 0.19.2 delta/State#::HunkZerorust-analyzer cargo git-delta 0.19.2 delta/State#HunkZero#(DiffTyperust-analyzer cargo git-delta 0.19.2 delta/DiffType#::Unifiedrust-analyzer cargo git-delta 0.19.2 delta/DiffType#Unified#, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#), |
| 69 | BgShouldFillrust-analyzer cargo git-delta 0.19.2 paint/BgShouldFill#::defaultrust-analyzer cargo git-delta 0.19.2 paint/impl#[BgShouldFill][Default]default().(), |
| 70 | ) |
| 71 | } |
| 72 | painter.emitrust-analyzer cargo git-delta 0.19.2 paint/impl#[`Painter<'p>`]emit().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 73 | } |
| 74 | } |
| 75 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 76 | } |