diff --git a/crates/nu-command/src/core_commands/tutor.rs b/crates/nu-command/src/core_commands/tutor.rs index 738777874..a5c585328 100644 --- a/crates/nu-command/src/core_commands/tutor.rs +++ b/crates/nu-command/src/core_commands/tutor.rs @@ -351,7 +351,7 @@ ls | each {|x| $x.name} ``` The above will create a list of the filenames in the directory. ``` -if true { echo "it's true" } { echo "it's not true" } +if true { echo "it's true" } else { echo "it's not true" } ``` This `if` call will run the first block if the expression is true, or the second block if the expression is false. diff --git a/crates/nu-command/src/filters/sort_by.rs b/crates/nu-command/src/filters/sort_by.rs index 7ac14590f..4e88f4e8a 100644 --- a/crates/nu-command/src/filters/sort_by.rs +++ b/crates/nu-command/src/filters/sort_by.rs @@ -97,6 +97,27 @@ impl Command for SortBy { span: Span::test_data(), }), }, + Example { + description: "Sort a table by its column (reversed order)", + example: "[[fruit count]; [apple 9] [pear 3] [orange 7]] | sort-by fruit -r", + result: Some(Value::List { + vals: vec![ + Value::test_record( + vec!["fruit", "count"], + vec![Value::test_string("pear"), Value::test_int(3)], + ), + Value::test_record( + vec!["fruit", "count"], + vec![Value::test_string("orange"), Value::test_int(7)], + ), + Value::test_record( + vec!["fruit", "count"], + vec![Value::test_string("apple"), Value::test_int(9)], + ), + ], + span: Span::test_data(), + }), + }, ] }