nushell/crates/nu-command
Antoine Stevan be5ed3290c
add "to nuon" enumeration of possible styles (#12591)
# Description
in order to change the style of the _serialized_ NUON data,
`nuon::to_nuon` takes three mutually exclusive arguments, `raw: bool`,
`tabs: Option<usize>` and `indent: Option<usize>` 🤔
this begs to use an enumeration with all possible alternatives, right?

this PR changes the signature of `nuon::to_nuon` to use `nuon::ToStyle`
which has three variants
- `Raw`: no newlines
- `Tabs(n: usize)`: newlines and `n` tabulations as indent
- `Spaces(n: usize)`: newlines and `n` spaces as indent

# User-Facing Changes
the signature of `nuon::to_nuon` changes from
```rust
to_nuon(
    input: &Value,
    raw: bool,
    tabs: Option<usize>,
    indent: Option<usize>,
    span: Option<Span>,
) -> Result<String, ShellError>
```
to
```rust
to_nuon(
    input: &Value,
    style: ToStyle,
    span: Option<Span>
) -> Result<String, ShellError>
```

# Tests + Formatting

# After Submitting
2024-04-20 11:40:52 +02:00
..
src add "to nuon" enumeration of possible styles (#12591) 2024-04-20 11:40:52 +02:00
tests add "to nuon" enumeration of possible styles (#12591) 2024-04-20 11:40:52 +02:00
Cargo.toml create nuon crate from from nuon and to nuon (#12553) 2024-04-19 13:54:16 +02:00
LICENSE Fix rest of license year ranges (#8727) 2023-04-04 09:03:29 +12:00