Use IntoValue in config code (#13751)

# Description

Cleans up and refactors the config code using the `IntoValue` macro.
Shoutout to @cptpiepmatz for making the macro!

# User-Facing Changes

Should be none.

# After Submitting

Somehow refactor the reverse transformation.
This commit is contained in:
Ian Manske
2024-09-05 00:44:23 -07:00
committed by GitHub
parent 4792328d0e
commit abd230e12e
37 changed files with 992 additions and 1206 deletions

View File

@ -177,8 +177,8 @@ impl ExploreConfig {
pub fn from_nu_config(config: &Config) -> Self {
let mut ret = Self::default();
ret.table.column_padding_left = config.table_indent.left;
ret.table.column_padding_right = config.table_indent.right;
ret.table.column_padding_left = config.table.padding.left;
ret.table.column_padding_right = config.table.padding.right;
let explore_cfg_hash_map = config.explore.clone();
let colors = get_color_map(&explore_cfg_hash_map);

View File

@ -36,8 +36,8 @@ fn try_build_map(
signals,
Span::unknown(),
usize::MAX,
(config.table_indent.left, config.table_indent.right),
config.table_mode,
(config.table.padding.left, config.table.padding.right),
config.table.mode,
0,
false,
);
@ -63,8 +63,8 @@ fn try_build_list(
signals,
Span::unknown(),
usize::MAX,
(config.table_indent.left, config.table_indent.right),
config.table_mode,
(config.table.padding.left, config.table.padding.right),
config.table.mode,
0,
false,
);