nushell/crates/nu-command/src
Antoine Stevan 17abbdf6e0
allow into duration to take an integer amount of ns (#10286)
related to
-
https://discord.com/channels/601130461678272522/615329862395101194/1149717458786197524

# Description
because `1_234 | into datetime` takes an integer number of `ns` and
`1_234 | into filesize` takes an integer amount of bytes, i think `1_234
| into duration` should also be valid and see `1_234` as an integer
amount of `ns` 😋

# User-Facing Changes
## before
either
```nushell
1234 | into string | $in ++ "ns" | into duration
```
```nushell
1234 | $"($in)ns" | into duration
```
or
```nushell
1234 * 1ns
```
and
```nushell
> 1_234 | into duration
Error: nu::parser::input_type_mismatch

  × Command does not support int input.
   ╭─[entry #2:1:1]
 1 │ 1_234 | into duration
   ·         ──────┬──────
   ·               ╰── command doesn't support int input
   ╰────
```

## after
```nushell
> 1_234 | into duration
1µs 234ns
```

# Tests + Formatting
new example test
```rust
Example {
    description: "Convert a number of ns to duration",
    example: "1_234_567 | into duration",
    result: Some(Value::duration(1_234_567, span)),
}
```

# After Submitting
2023-09-09 13:49:08 -05:00
..
bytes Move Value to helpers, separate span call (#10121) 2023-09-03 07:27:29 -07:00
charting Move Value to helpers, separate span call (#10121) 2023-09-03 07:27:29 -07:00
conversions allow into duration to take an integer amount of ns (#10286) 2023-09-09 13:49:08 -05:00
database Move Value to helpers, separate span call (#10121) 2023-09-03 07:27:29 -07:00
date Move Value to helpers, separate span call (#10121) 2023-09-03 07:27:29 -07:00
debug Move Value to helpers, separate span call (#10121) 2023-09-03 07:27:29 -07:00
env Move Value to helpers, separate span call (#10121) 2023-09-03 07:27:29 -07:00
experimental Add functions for each Value case (#9736) 2023-07-21 08:20:33 -05:00
filesystem use uutils/coreutils cp command in place of nushell's cp command (#10097) 2023-09-08 13:57:38 -05:00
filters allow update to use metadata (#10264) 2023-09-09 13:47:42 -05:00
formats rename the types with spaces in them to use - (#9929) 2023-09-06 13:22:12 -05:00
generators Move Value to helpers, separate span call (#10121) 2023-09-03 07:27:29 -07:00
hash Move Value to helpers, separate span call (#10121) 2023-09-03 07:27:29 -07:00
help Move Value to helpers, separate span call (#10121) 2023-09-03 07:27:29 -07:00
math Move Value to helpers, separate span call (#10121) 2023-09-03 07:27:29 -07:00
misc REFACTOR: move source out of deprecated commands (#9060) 2023-05-04 00:02:03 +02:00
network Move Value to helpers, separate span call (#10121) 2023-09-03 07:27:29 -07:00
path Move Value to helpers, separate span call (#10121) 2023-09-03 07:27:29 -07:00
platform signpost 'input list --types [key]' from 'keybindings list' (#10287) 2023-09-09 09:42:37 -05:00
random Move Value to helpers, separate span call (#10121) 2023-09-03 07:27:29 -07:00
removed Rename misused "deprecation" to removal (#10000) 2023-08-15 07:17:31 +12:00
shells Fix usage for the exit command. (#9450) 2023-06-16 10:09:02 +02:00
strings update format date when using %x %X %r (#10272) 2023-09-08 08:59:05 -05:00
system add more ps columns in Windows (#10275) 2023-09-08 12:24:29 -05:00
viewers add 6 more table themes (#10279) 2023-09-08 16:34:36 -05:00
default_context.rs use uutils/coreutils cp command in place of nushell's cp command (#10097) 2023-09-08 13:57:38 -05:00
example_test.rs enable/update some example tests so they work again (#10058) 2023-08-19 09:06:59 -05:00
lib.rs Move eval_hook to nu-cmd-base (#10146) 2023-08-29 23:46:50 +02:00
progress_bar.rs cp progress bar implementation (#8012) 2023-02-22 11:57:38 -08:00
sort_utils.rs Move Value to helpers, separate span call (#10121) 2023-09-03 07:27:29 -07:00