bugfix: add "to yml" command (#15254)

# Description
This fixes #15240, which can be closed after merge.

# User-Facing Changes
- user get now use `to yml` -> exactly the same as `to yaml`


![2025-03-06_00h01_27](https://github.com/user-attachments/assets/e002a96a-26dd-4f9c-9b45-b456a95be158)

# Tests + Formatting
Cargo fmt and clippy 🆗 
I added a test in the only place I could find where `to yaml` was
already tested.

I didn't see the `save.rs::convert_to_extension` function tested
anywhere, but maybe I missed it.

# After Submitting

Not sure this needs an update on the documentation  What do you
suggest?

---------

Co-authored-by: Stefan Holderbach <sholderbach@users.noreply.github.com>
This commit is contained in:
Loïc Riegel
2025-03-06 14:32:36 +01:00
committed by GitHub
parent f3982278e8
commit 0e6e9abc12
4 changed files with 64 additions and 2 deletions

View File

@ -15,6 +15,21 @@ fn table_to_yaml_text_and_from_yaml_text_back_into_table() {
assert_eq!(actual.out, "nushell");
}
#[test]
fn table_to_yml_text_and_from_yml_text_back_into_table() {
let actual = nu!(
cwd: "tests/fixtures/formats", pipeline(
r#"
open appveyor.yml
| to yml
| from yml
| get environment.global.PROJECT_NAME
"#
));
assert_eq!(actual.out, "nushell");
}
#[test]
fn convert_dict_to_yaml_with_boolean_key() {
let actual = nu!(pipeline(