Debian Codegraph @

src/subcommands/show_config.rs

raw symbols SCIP
1 use 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/::Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#;
2
3 use itertoolsrust-analyzer cargo itertools 0.14.0 crate/::Itertoolsrust-analyzer cargo itertools 0.14.0 Itertools#;
4
5 use craterust-analyzer cargo git-delta 0.19.2 crate/::clirust-analyzer cargo git-delta 0.19.2 cli/;
6 use craterust-analyzer cargo git-delta 0.19.2 crate/::configrust-analyzer cargo git-delta 0.19.2 config/;
7 use craterust-analyzer cargo git-delta 0.19.2 crate/::featuresrust-analyzer cargo git-delta 0.19.2 features/::side_by_siderust-analyzer cargo git-delta 0.19.2 features/side_by_side/::{Leftrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlusIndex#Minus#, Rightrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlusIndex#Plus#};
8 use craterust-analyzer cargo git-delta 0.19.2 crate/::minusplusrust-analyzer cargo git-delta 0.19.2 minusplus/::*;
9 use craterust-analyzer cargo git-delta 0.19.2 crate/::paintrust-analyzer cargo git-delta 0.19.2 paint/::BgFillMethodrust-analyzer cargo git-delta 0.19.2 paint/BgFillMethod#;
10 use craterust-analyzer cargo git-delta 0.19.2 crate/::stylerust-analyzer cargo git-delta 0.19.2 style/;
11 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/::PagingModerust-analyzer cargo git-delta 0.19.2 utils/bat/output/PagingMode#;
12
13 pub fn show_configrust-analyzer cargo git-delta 0.19.2 subcommands/show_config/show_config().(config: &configrust-analyzer cargo git-delta 0.19.2 config/::Configrust-analyzer cargo git-delta 0.19.2 config/Config#, writer: &mut dyn Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#) -> 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 // styles first
15 writelnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/writeln!!(
16 writer,
17 " commit-style = {commit_style}
18 file-style = {file_style}
19 hunk-header-style = {hunk_header_style}
20 minus-style = {minus_style}
21 minus-non-emph-style = {minus_non_emph_style}
22 minus-emph-style = {minus_emph_style}
23 minus-empty-line-marker-style = {minus_empty_line_marker_style}
24 zero-style = {zero_style}
25 plus-style = {plus_style}
26 plus-non-emph-style = {plus_non_emph_style}
27 plus-emph-style = {plus_emph_style}
28 plus-empty-line-marker-style = {plus_empty_line_marker_style}
29 grep-file-style = {grep_file_style}
30 grep-line-number-style = {grep_line_number_style}
31 whitespace-error-style = {whitespace_error_style}
32 blame-palette = {blame_palette}",
33 blame_palette = config
34 .blame_paletterust-analyzer cargo git-delta 0.19.2 config/Config#blame_palette.
35 .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()
36 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|s| stylerust-analyzer cargo git-delta 0.19.2 style/::paint_color_stringrust-analyzer cargo git-delta 0.19.2 style/paint_color_string().(s, 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().()))
37 .joinrust-analyzer cargo itertools 0.14.0 Itertools#join().(" "),
38 commit_style = config.commit_stylerust-analyzer cargo git-delta 0.19.2 config/Config#commit_style..to_painted_stringrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]to_painted_string().(),
39 file_style = config.file_stylerust-analyzer cargo git-delta 0.19.2 config/Config#file_style..to_painted_stringrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]to_painted_string().(),
40 hunk_header_style = config.hunk_header_stylerust-analyzer cargo git-delta 0.19.2 config/Config#hunk_header_style..to_painted_stringrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]to_painted_string().(),
41 minus_emph_style = config.minus_emph_stylerust-analyzer cargo git-delta 0.19.2 config/Config#minus_emph_style..to_painted_stringrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]to_painted_string().(),
42 minus_empty_line_marker_style = config.minus_empty_line_marker_stylerust-analyzer cargo git-delta 0.19.2 config/Config#minus_empty_line_marker_style..to_painted_stringrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]to_painted_string().(),
43 minus_non_emph_style = config.minus_non_emph_stylerust-analyzer cargo git-delta 0.19.2 config/Config#minus_non_emph_style..to_painted_stringrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]to_painted_string().(),
44 minus_style = config.minus_stylerust-analyzer cargo git-delta 0.19.2 config/Config#minus_style..to_painted_stringrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]to_painted_string().(),
45 plus_emph_style = config.plus_emph_stylerust-analyzer cargo git-delta 0.19.2 config/Config#plus_emph_style..to_painted_stringrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]to_painted_string().(),
46 plus_empty_line_marker_style = config.plus_empty_line_marker_stylerust-analyzer cargo git-delta 0.19.2 config/Config#plus_empty_line_marker_style..to_painted_stringrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]to_painted_string().(),
47 plus_non_emph_style = config.plus_non_emph_stylerust-analyzer cargo git-delta 0.19.2 config/Config#plus_non_emph_style..to_painted_stringrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]to_painted_string().(),
48 plus_style = config.plus_stylerust-analyzer cargo git-delta 0.19.2 config/Config#plus_style..to_painted_stringrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]to_painted_string().(),
49 grep_file_style = config.grep_file_stylerust-analyzer cargo git-delta 0.19.2 config/Config#grep_file_style..to_painted_stringrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]to_painted_string().(),
50 grep_line_number_style = config.grep_line_number_stylerust-analyzer cargo git-delta 0.19.2 config/Config#grep_line_number_style..to_painted_stringrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]to_painted_string().(),
51 whitespace_error_style = config.whitespace_error_stylerust-analyzer cargo git-delta 0.19.2 config/Config#whitespace_error_style..to_painted_stringrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]to_painted_string().(),
52 zero_style = config.zero_stylerust-analyzer cargo git-delta 0.19.2 config/Config#zero_style..to_painted_stringrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]to_painted_string().(),
53 )?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
54 // Everything else
55 writelnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/writeln!!(
56 writer,
57 " true-color = {true_color}
58 file-added-label = {file_added_label}
59 file-modified-label = {file_modified_label}
60 file-removed-label = {file_removed_label}
61 file-renamed-label = {file_renamed_label}
62 right-arrow = {right_arrow}",
63 true_color = config.true_colorrust-analyzer cargo git-delta 0.19.2 config/Config#true_color.,
64 file_added_label = format_option_valuerust-analyzer cargo git-delta 0.19.2 subcommands/show_config/format_option_value().(&config.file_added_labelrust-analyzer cargo git-delta 0.19.2 config/Config#file_added_label.),
65 file_modified_label = format_option_valuerust-analyzer cargo git-delta 0.19.2 subcommands/show_config/format_option_value().(&config.file_modified_labelrust-analyzer cargo git-delta 0.19.2 config/Config#file_modified_label.),
66 file_removed_label = format_option_valuerust-analyzer cargo git-delta 0.19.2 subcommands/show_config/format_option_value().(&config.file_removed_labelrust-analyzer cargo git-delta 0.19.2 config/Config#file_removed_label.),
67 file_renamed_label = format_option_valuerust-analyzer cargo git-delta 0.19.2 subcommands/show_config/format_option_value().(&config.file_renamed_labelrust-analyzer cargo git-delta 0.19.2 config/Config#file_renamed_label.),
68 right_arrow = format_option_valuerust-analyzer cargo git-delta 0.19.2 subcommands/show_config/format_option_value().(&config.right_arrowrust-analyzer cargo git-delta 0.19.2 config/Config#right_arrow.),
69 )?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
70 writelnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/writeln!!(
71 writer,
72 " hyperlinks = {hyperlinks}",
73 hyperlinks = config.hyperlinksrust-analyzer cargo git-delta 0.19.2 config/Config#hyperlinks.
74 )?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
75 if config.hyperlinksrust-analyzer cargo git-delta 0.19.2 config/Config#hyperlinks. {
76 writelnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/writeln!!(
77 writer,
78 " hyperlinks-file-link-format = {hyperlinks_file_link_format}",
79 hyperlinks_file_link_format = format_option_valuerust-analyzer cargo git-delta 0.19.2 subcommands/show_config/format_option_value().(&config.hyperlinks_file_link_formatrust-analyzer cargo git-delta 0.19.2 config/Config#hyperlinks_file_link_format.),
80 )?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().
81 }
82 writelnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/writeln!!(
83 writer,
84 " inspect-raw-lines = {inspect_raw_lines}
85 keep-plus-minus-markers = {keep_plus_minus_markers}",
86 inspect_raw_lines = match config.inspect_raw_linesrust-analyzer cargo git-delta 0.19.2 config/Config#inspect_raw_lines. {
87 clirust-analyzer cargo git-delta 0.19.2 cli/::InspectRawLinesrust-analyzer cargo git-delta 0.19.2 cli/InspectRawLines#::Truerust-analyzer cargo git-delta 0.19.2 cli/InspectRawLines#True# => "true",
88 clirust-analyzer cargo git-delta 0.19.2 cli/::InspectRawLinesrust-analyzer cargo git-delta 0.19.2 cli/InspectRawLines#::Falserust-analyzer cargo git-delta 0.19.2 cli/InspectRawLines#False# => "false",
89 },
90 keep_plus_minus_markers = config.keep_plus_minus_markersrust-analyzer cargo git-delta 0.19.2 config/Config#keep_plus_minus_markers.,
91 )?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
92 writelnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/writeln!!(
93 writer,
94 " line-numbers = {line_numbers}",
95 line_numbers = config.line_numbersrust-analyzer cargo git-delta 0.19.2 config/Config#line_numbers.
96 )?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
97 if config.line_numbersrust-analyzer cargo git-delta 0.19.2 config/Config#line_numbers. {
98 writelnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/writeln!!(
99 writer,
100 " line-numbers-minus-style = {line_numbers_minus_style}
101 line-numbers-zero-style = {line_numbers_zero_style}
102 line-numbers-plus-style = {line_numbers_plus_style}
103 line-numbers-left-style = {line_numbers_left_style}
104 line-numbers-right-style = {line_numbers_right_style}
105 line-numbers-left-format = {line_numbers_left_format}
106 line-numbers-right-format = {line_numbers_right_format}",
107 line_numbers_minus_style =
108 config.line_numbers_style_minusplusrust-analyzer cargo git-delta 0.19.2 config/Config#line_numbers_style_minusplus.[rust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`][`Index<MinusPlusIndex>`]index().Minusrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlusIndex#Minus#]rust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`][`Index<MinusPlusIndex>`]index()..to_painted_stringrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]to_painted_string().(),
109 line_numbers_zero_style = config.line_numbers_zero_stylerust-analyzer cargo git-delta 0.19.2 config/Config#line_numbers_zero_style..to_painted_stringrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]to_painted_string().(),
110 line_numbers_plus_style = config.line_numbers_style_minusplusrust-analyzer cargo git-delta 0.19.2 config/Config#line_numbers_style_minusplus.[rust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`][`Index<MinusPlusIndex>`]index().Plusrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlusIndex#Plus#]rust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`][`Index<MinusPlusIndex>`]index()..to_painted_stringrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]to_painted_string().(),
111 line_numbers_left_style = config.line_numbers_style_leftrightrust-analyzer cargo git-delta 0.19.2 config/Config#line_numbers_style_leftright.[rust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`][`Index<MinusPlusIndex>`]index().Leftrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlusIndex#Minus#]rust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`][`Index<MinusPlusIndex>`]index()..to_painted_stringrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]to_painted_string().(),
112 line_numbers_right_style =
113 config.line_numbers_style_leftrightrust-analyzer cargo git-delta 0.19.2 config/Config#line_numbers_style_leftright.[rust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`][`Index<MinusPlusIndex>`]index().Rightrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlusIndex#Plus#]rust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`][`Index<MinusPlusIndex>`]index()..to_painted_stringrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]to_painted_string().(),
114 line_numbers_left_format = format_option_valuerust-analyzer cargo git-delta 0.19.2 subcommands/show_config/format_option_value().(&config.line_numbers_formatrust-analyzer cargo git-delta 0.19.2 config/Config#line_numbers_format.[rust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`][`Index<MinusPlusIndex>`]index().Leftrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlusIndex#Minus#]rust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`][`Index<MinusPlusIndex>`]index().),
115 line_numbers_right_format = format_option_valuerust-analyzer cargo git-delta 0.19.2 subcommands/show_config/format_option_value().(&config.line_numbers_formatrust-analyzer cargo git-delta 0.19.2 config/Config#line_numbers_format.[rust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`][`Index<MinusPlusIndex>`]index().Rightrust-analyzer cargo git-delta 0.19.2 minusplus/MinusPlusIndex#Plus#]rust-analyzer cargo git-delta 0.19.2 minusplus/impl#[`MinusPlus<T>`][`Index<MinusPlusIndex>`]index().),
116 )?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().
117 }
118 writelnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/writeln!!(
119 writer,
120 " max-line-distance = {max_line_distance}
121 max-line-length = {max_line_length}
122 diff-stat-align-width = {diff_stat_align_width}
123 line-fill-method = {line_fill_method}
124 navigate = {navigate}
125 navigate-regex = {navigate_regex}
126 pager = {pager}
127 paging = {paging_mode}
128 side-by-side = {side_by_side}
129 syntax-theme = {syntax_theme}
130 width = {width}
131 tabs = {tab_width}
132 word-diff-regex = {tokenization_regex}",
133 diff_stat_align_width = config.diff_stat_align_widthrust-analyzer cargo git-delta 0.19.2 config/Config#diff_stat_align_width.,
134 max_line_distance = config.max_line_distancerust-analyzer cargo git-delta 0.19.2 config/Config#max_line_distance.,
135 max_line_length = config.max_line_lengthrust-analyzer cargo git-delta 0.19.2 config/Config#max_line_length.,
136 line_fill_method = match config.line_fill_methodrust-analyzer cargo git-delta 0.19.2 config/Config#line_fill_method. {
137 BgFillMethodrust-analyzer cargo git-delta 0.19.2 paint/BgFillMethod#::TryAnsiSequencerust-analyzer cargo git-delta 0.19.2 paint/BgFillMethod#TryAnsiSequence# => "ansi",
138 BgFillMethodrust-analyzer cargo git-delta 0.19.2 paint/BgFillMethod#::Spacesrust-analyzer cargo git-delta 0.19.2 paint/BgFillMethod#Spaces# => "spaces",
139 },
140 navigate = config.navigaterust-analyzer cargo git-delta 0.19.2 config/Config#navigate.,
141 navigate_regex = match &config.navigate_regexrust-analyzer cargo git-delta 0.19.2 config/Config#navigate_regex. {
142 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => "".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
143 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(s) => format_option_valuerust-analyzer cargo git-delta 0.19.2 subcommands/show_config/format_option_value().(s),
144 },
145 pager = config.pagerrust-analyzer cargo git-delta 0.19.2 config/Config#pager..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Clone]clone().().unwrap_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_else().(|| "none".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()),
146 paging_mode = match config.paging_moderust-analyzer cargo git-delta 0.19.2 config/Config#paging_mode. {
147 PagingModerust-analyzer cargo git-delta 0.19.2 utils/bat/output/PagingMode#::Alwaysrust-analyzer cargo git-delta 0.19.2 utils/bat/output/PagingMode#Always# => "always",
148 PagingModerust-analyzer cargo git-delta 0.19.2 utils/bat/output/PagingMode#::Neverrust-analyzer cargo git-delta 0.19.2 utils/bat/output/PagingMode#Never# => "never",
149 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# => "auto",
150 PagingModerust-analyzer cargo git-delta 0.19.2 utils/bat/output/PagingMode#::Capturerust-analyzer cargo git-delta 0.19.2 utils/bat/output/PagingMode#Capture# => unreachablerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/unreachable!!("capture can not be set"),
151 },
152 side_by_side = config.side_by_siderust-analyzer cargo git-delta 0.19.2 config/Config#side_by_side.,
153 syntax_theme = config
154 .syntax_themerust-analyzer cargo git-delta 0.19.2 config/Config#syntax_theme.
155 .clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Clone]clone().()
156 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|t| t.namerust-analyzer cargo syntect 5.3.0 highlighting/theme/Theme#name..unwrap_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_else().(|| "none".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()))
157 .unwrap_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_else().(|| "none".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()),
158 width = match config.decorations_widthrust-analyzer cargo git-delta 0.19.2 config/Config#decorations_width. {
159 clirust-analyzer cargo git-delta 0.19.2 cli/::Widthrust-analyzer cargo git-delta 0.19.2 cli/Width#::Fixedrust-analyzer cargo git-delta 0.19.2 cli/Width#Fixed#(width) => width.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
160 clirust-analyzer cargo git-delta 0.19.2 cli/::Widthrust-analyzer cargo git-delta 0.19.2 cli/Width#::Variablerust-analyzer cargo git-delta 0.19.2 cli/Width#Variable# => "variable".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
161 },
162 tab_width = config.tab_cfgrust-analyzer cargo git-delta 0.19.2 config/Config#tab_cfg..widthrust-analyzer cargo git-delta 0.19.2 utils/tabs/impl#[TabCfg]width().(),
163 tokenization_regex = format_option_valuerust-analyzer cargo git-delta 0.19.2 subcommands/show_config/format_option_value().(config.tokenization_regexrust-analyzer cargo git-delta 0.19.2 config/Config#tokenization_regex..to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()),
164 )?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
165 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
166 }
167
168 // Heuristics determining whether to quote string option values when printing values intended for
169 // git config.
170 fn format_option_valuerust-analyzer cargo git-delta 0.19.2 subcommands/show_config/format_option_value().<S>(s: S) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#
171 where
172 S: AsRefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#<str>,
173 {
174 let s = s.as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#as_ref().();
175 if s.ends_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]ends_with().(' ')
176 || s.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().(' ')
177 || s.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]contains().(&['\\', '{', '}', ':'][rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().)
178 || s.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().()
179 {
180 formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("'{s}'")
181 } else {
182 s.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()
183 }
184 }
185
186 #[cfg(test)]
187 mod testsrust-analyzer cargo git-delta 0.19.2 subcommands/show_config/tests/ {
188 use craterust-analyzer cargo git-delta 0.19.2 crate/::testsrust-analyzer cargo git-delta 0.19.2 tests/::integration_test_utilsrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/;
189
190 use superrust-analyzer cargo git-delta 0.19.2 subcommands/show_config/::*;
191 use craterust-analyzer cargo git-delta 0.19.2 crate/::ansirust-analyzer cargo git-delta 0.19.2 ansi/;
192 use 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/::{Cursorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/cursor/Cursor#, Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#, Seekrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Seek#};
193
194 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
195 fn test_show_configrust-analyzer cargo git-delta 0.19.2 subcommands/show_config/tests/test_show_config().() {
196 let config = integration_test_utilsrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/::make_config_from_argsrust-analyzer cargo git-delta 0.19.2 tests/integration_test_utils/make_config_from_args().(&[]);
197 let mut writer = Cursorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/cursor/Cursor#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/cursor/impl#[`Cursor<T>`]new().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0; 1024]);
198 show_configrust-analyzer cargo git-delta 0.19.2 subcommands/show_config/show_config().(&config, &mut writer).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
199 let mut s = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().();
200 writer.rewindrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Seek#rewind().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
201 writer.read_to_stringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/cursor/impl#[`Cursor<T>`][Read]read_to_string().(&mut s).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
202 let s = ansirust-analyzer cargo git-delta 0.19.2 ansi/::strip_ansi_codesrust-analyzer cargo git-delta 0.19.2 ansi/strip_ansi_codes().(&s);
203 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(s.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]contains().(" commit-style = raw\n"));
204 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(s.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]contains().(r" word-diff-regex = '\w+'"));
205 }
206 }