nushell/crates/nu-protocol/src
Devyn Cairns 6795ad7e33
Make custom value type handling more consistent (#12230)
[Context on
Discord](https://discord.com/channels/601130461678272522/855947301380947968/1219425984990806207)

# Description

- Rename `CustomValue::value_string()` to `type_name()` to reflect its
usage better.
- Change print behavior to always call `to_base_value()` first, to give
the custom value better control over the output.
- Change `describe --detailed` to show the type name as the subtype,
rather than trying to describe the base value.
- Change custom `Type` to use `type_name()` rather than `typetag_name()`
to make things like `PluginCustomValue` more transparent

One question: should `describe --detailed` still include a description
of the base value somewhere? I'm torn on it, it seems possibly useful
for some things (maybe sqlite databases?), but having `describe -d` not
include the custom type name anywhere felt weird. Another option would
be to add another method to `CustomValue` for info to be displayed in
`describe`, so that it can be more type-specific?

# User-Facing Changes
Everything above has implications for printing and `describe` on custom
values

# Tests + Formatting
- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
- 🟢 `toolkit test`
- 🟢 `toolkit test stdlib`
2024-03-19 11:09:59 +01:00
..
ast IO and redirection overhaul (#11934) 2024-03-14 15:51:55 -05:00
config Keep plugins persistently running in the background (#12064) 2024-03-09 17:10:22 -06:00
debugger IO and redirection overhaul (#11934) 2024-03-14 15:51:55 -05:00
engine IO and redirection overhaul (#11934) 2024-03-14 15:51:55 -05:00
errors IO and redirection overhaul (#11934) 2024-03-14 15:51:55 -05:00
pipeline_data IO and redirection overhaul (#11934) 2024-03-14 15:51:55 -05:00
plugin Keep plugins persistently running in the background (#12064) 2024-03-09 17:10:22 -06:00
value Make custom value type handling more consistent (#12230) 2024-03-19 11:09:59 +01:00
alias.rs IO and redirection overhaul (#11934) 2024-03-14 15:51:55 -05:00
did_you_mean.rs Improve case insensitivity consistency (#10884) 2023-11-08 23:58:54 +01:00
eval_base.rs IO and redirection overhaul (#11934) 2024-03-14 15:51:55 -05:00
eval_const.rs IO and redirection overhaul (#11934) 2024-03-14 15:51:55 -05:00
example.rs Fix ignored clippy lints (#12160) 2024-03-11 19:46:04 +01:00
id.rs Add virtual path abstraction layer (#9245) 2023-05-23 23:48:50 +03:00
lev_distance.rs Suggest existing variables on not found (#8902) 2023-05-02 18:17:14 +03:00
lib.rs Restructure nu-protocol in more meaningful units (#11917) 2024-03-10 18:45:45 +01:00
module.rs Error on use path item1 item2, if item1 is not a module (#11183) 2023-12-05 11:38:45 +01:00
signature.rs Replace debug_assert! with assert! in Signature::check_names (#11937) 2024-02-22 16:17:06 -06:00
span.rs Replace panics with errors in thread spawning (#12040) 2024-03-02 11:14:02 -06:00
syntax_shape.rs open, rm, umv, cp, rm and du: Don't globs if inputs are variables or string interpolation (#11886) 2024-02-23 09:17:09 +08:00
ty.rs Glob: don't allow implicit casting between glob and string (#11992) 2024-02-28 23:05:35 +08:00
util.rs Convert more ShellError variants to named fields (#11173) 2023-11-28 06:43:51 -06:00