nushell/crates/nu-command/src/conversions/into
mike 0e4729b203
improve parsing of values with units (#9190)
closes #9111 

# Description

this pr improves parsing of values with units (`filesizes`, `durations`
and any other **future values**) by:

1. allowing underscores in the value part
```nu
> 42kb          # okay
> 42_sec        # okay
> 1_000_000mib  # okay
> 69k_b         # not okay, underscores not allowed in the unit
```

2. improving error messages involving these values
```nu
> sleep 40-sec

# before
Error: nu::parser::parse_mismatch

  × Parse mismatch during operation.
   ╭─[entry #42:1:1]
 1 │ sleep 40-sec
   ·       ──┬──
   ·         ╰── expected duration with valid units
   ╰────

# now
Error:
  × duration value must be a number
   ╭─[entry #41:1:1]
 1 │ sleep 40-sec
   ·       ─┬─
   ·        ╰── not a number
   ╰────
```

3. unifying parsing of these values. now all of these use one function

# User-Facing Changes

filesizes and durations can now have underscores for readability
2023-05-17 18:54:35 -05:00
..
binary.rs Box ShellError in Value::Error (#8375) 2023-03-12 09:57:27 +01:00
bool.rs Box ShellError in Value::Error (#8375) 2023-03-12 09:57:27 +01:00
command.rs Use imported names in Command::run signatures (#7967) 2023-02-05 22:17:46 +01:00
datetime.rs Box ShellError in Value::Error (#8375) 2023-03-12 09:57:27 +01:00
decimal.rs Fix into decimal command category (#8932) 2023-04-19 11:39:12 -05:00
duration.rs improve parsing of values with units (#9190) 2023-05-17 18:54:35 -05:00
filesize.rs Box ShellError in Value::Error (#8375) 2023-03-12 09:57:27 +01:00
int.rs Box ShellError in Value::Error (#8375) 2023-03-12 09:57:27 +01:00
mod.rs Revert "into cellpath command (#7417)" (#7523) 2022-12-18 23:02:18 -08:00
record.rs Box ShellError in Value::Error (#8375) 2023-03-12 09:57:27 +01:00
string.rs Box ShellError in Value::Error (#8375) 2023-03-12 09:57:27 +01:00