Closed webbedspace closed 1 year ago
Agreed that this is a good conversation to have.
It may also be good to have an official blessed command like config set key value
/config get key
with better error handling and config value enforcement.
We used to have a config command in version 44, pre engine-q. Here's a screenshot.
Related problem
Breakoff of discussion here.
$env.config
access is currently a brittle way of querying the system configuration state (e.g. to check the state ofalways_trash
for UX purposes), because you can put invalid values on $env.config like$env.config.rm_always_trash = 'foobarbaz'
and have it actually stick on the record (even though doing so does not update EngineState for obvious reasons), and moreover you can write things likelet-env config = "foobarbaz"
that just blow the whole record away outright.Describe the solution you'd like
My idea is that each $env.config access (that is to say, anything that reads from that value) causes Nushell to instead create and return a new record which always and only has values corresponding to those on the EngineState.config struct.
The struct looks like this:
$env.config
access would thus produce a record holdingexternal_completer, filesize_metric, table_mode, use_ls_colors, color_config, use_grid_icons, footer_mode, float_precision, max_external_completion_results, filesize_format, use_ansi_coloring, quick_completions, partial_completions, completion_algorithm, edit_mode, max_history_size, sync_history_on_enter, history_file_format, log_level, keybindings, menus, hooks, rm_always_trash, shell_integration, buffer_editor, table_index_mode, cd_with_abbreviations, case_sensitive_completions, enable_external_completion, trim_strategy, show_banner, show_clickable_links_in_ls, render_right_prompt_on_last_line
keys.Now, HistoryFileFormat, FooterMode, TrimStrategy and TableIndexMode can be translated back to Nuon values relatively easily. ParsedKeybinding and ParsedMenu might be a bit trickier (haven't examined them just yet).
Describe alternatives you've considered
No response
Additional context and details
No response