nushell/crates/nu-command/src/formats/to
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
..
command.rs Add command_prelude module (#12291) 2024-03-26 21:17:30 +00:00
csv.rs Add command_prelude module (#12291) 2024-03-26 21:17:30 +00:00
delimited.rs Rename Value::CustomValue to Value::Custom (#12309) 2024-03-27 22:10:56 +01:00
json.rs Rename Value::CustomValue to Value::Custom (#12309) 2024-03-27 22:10:56 +01:00
md.rs Add command_prelude module (#12291) 2024-03-26 21:17:30 +00:00
mod.rs create nuon crate from from nuon and to nuon (#12553) 2024-04-19 13:54:16 +02:00
nuon.rs add "to nuon" enumeration of possible styles (#12591) 2024-04-20 11:40:52 +02:00
text.rs Copy-on-write for record values (#12305) 2024-04-14 01:42:03 +00:00
toml.rs Rename Value::CustomValue to Value::Custom (#12309) 2024-03-27 22:10:56 +01:00
tsv.rs Add command_prelude module (#12291) 2024-03-26 21:17:30 +00:00
xml.rs Copy-on-write for record values (#12305) 2024-04-14 01:42:03 +00:00
yaml.rs Rename Value::CustomValue to Value::Custom (#12309) 2024-03-27 22:10:56 +01:00