From f84831b896e53da1712eb93a2151263da67d03bb Mon Sep 17 00:00:00 2001 From: Ian Manske Date: Sun, 24 Nov 2024 16:06:37 -0800 Subject: [PATCH] Update `std help operators` --- crates/nu-std/std/help/mod.nu | 79 ++++++++++++++++++----------------- 1 file changed, 40 insertions(+), 39 deletions(-) diff --git a/crates/nu-std/std/help/mod.nu b/crates/nu-std/std/help/mod.nu index 9f13f1bb18..52b4388367 100644 --- a/crates/nu-std/std/help/mod.nu +++ b/crates/nu-std/std/help/mod.nu @@ -32,45 +32,46 @@ def command-not-found-error [span: record] { throw-error "std::help::command_not_found" "command not found" $span } -def get-all-operators [] { return [ - [type, operator, name, description, precedence]; - - [Assignment, =, Assign, "Assigns a value to a variable.", 10] - [Assignment, +=, PlusAssign, "Adds a value to a variable.", 10] - [Assignment, ++=, ConcatAssign, "Concatenate two lists, two strings, or two binary values.", 10] - [Assignment, -=, MinusAssign, "Subtracts a value from a variable.", 10] - [Assignment, *=, MultiplyAssign, "Multiplies a variable by a value.", 10] - [Assignment, /=, DivideAssign, "Divides a variable by a value.", 10] - [Comparison, ==, Equal, "Checks if two values are equal.", 80] - [Comparison, !=, NotEqual, "Checks if two values are not equal.", 80] - [Comparison, <, LessThan, "Checks if a value is less than another.", 80] - [Comparison, <=, LessThanOrEqual, "Checks if a value is less than or equal to another.", 80] - [Comparison, >, GreaterThan, "Checks if a value is greater than another.", 80] - [Comparison, >=, GreaterThanOrEqual, "Checks if a value is greater than or equal to another.", 80] - [Comparison, '=~ or like', RegexMatch, "Checks if a value matches a regular expression.", 80] - [Comparison, '!~ or not-like', NotRegexMatch, "Checks if a value does not match a regular expression.", 80] - [Comparison, in, In, "Checks if a value is in a list or string.", 80] - [Comparison, not-in, NotIn, "Checks if a value is not in a list or string.", 80] - [Comparison, starts-with, StartsWith, "Checks if a string starts with another.", 80] - [Comparison, ends-with, EndsWith, "Checks if a string ends with another.", 80] - [Comparison, not, UnaryNot, "Negates a value or expression.", 0] - [Math, +, Plus, "Adds two values.", 90] - [Math, ++, Concat, "Concatenate two lists, two strings, or two binary values.", 80] - [Math, -, Minus, "Subtracts two values.", 90] - [Math, *, Multiply, "Multiplies two values.", 95] - [Math, /, Divide, "Divides two values.", 95] - [Math, //, FloorDivision, "Divides two values and floors the result.", 95] - [Math, mod, Modulo, "Divides two values and returns the remainder.", 95] - [Math, **, "Pow ", "Raises one value to the power of another.", 100] - [Bitwise, bit-or, BitOr, "Performs a bitwise OR on two values.", 60] - [Bitwise, bit-xor, BitXor, "Performs a bitwise XOR on two values.", 70] - [Bitwise, bit-and, BitAnd, "Performs a bitwise AND on two values.", 75] - [Bitwise, bit-shl, ShiftLeft, "Shifts a value left by another.", 85] - [Bitwise, bit-shr, ShiftRight, "Shifts a value right by another.", 85] - [Boolean, and, And, "Checks if two values are true.", 50] - [Boolean, or, Or, "Checks if either value is true.", 40] - [Boolean, xor, Xor, "Checks if one value is true and the other is false.", 45] -]} +def get-all-operators [] { + [ + [type, operator, name, description, precedence]; + [Assignment, =, Assign, 'Assigns a value to a variable.', 10] + [Assignment, +=, AddAssign, 'Adds a value to a variable.', 10] + [Assignment, -=, SubtractAssign, 'Subtracts a value from a variable.', 10] + [Assignment, *=, MultiplyAssign, 'Multiplies a variable by a value.', 10] + [Assignment, /=, DivideAssign, 'Divides a variable by a value.', 10] + [Assignment, ++=, ConcatenateAssign, 'Concatenates a list, a string, or a binary value to a variable of the same type.', 10] + [Comparison, ==, Equal, 'Checks if two values are equal.', 80] + [Comparison, !=, NotEqual, 'Checks if two values are not equal.', 80] + [Comparison, <, LessThan, 'Checks if a value is less than another.', 80] + [Comparison, >, GreaterThan, 'Checks if a value is greater than another.', 80] + [Comparison, <=, LessThanOrEqual, 'Checks if a value is less than or equal to another.', 80] + [Comparison, >=, GreaterThanOrEqual, 'Checks if a value is greater than or equal to another.', 80] + [Comparison, '=~ or like', RegexMatch, 'Checks if a value matches a regular expression.', 80] + [Comparison, '!~ or not-like', NotRegexMatch, 'Checks if a value does not match a regular expression.', 80] + [Comparison, in, In, 'Checks if a value is in a list, is part of a string, or is a key in a record.', 80] + [Comparison, not-in, NotIn, 'Checks if a value is not in a list, is not part of a string, or is not a key in a record.', 80] + [Comparison, starts-with, StartsWith, 'Checks if a string starts with another.', 80] + [Comparison, ends-with, EndsWith, 'Checks if a string ends with another.', 80] + [Math, +, Add, 'Adds two values.', 90] + [Math, -, Subtract, 'Subtracts two values.', 90] + [Math, *, Multiply, 'Multiplies two values.', 95] + [Math, /, Divide, 'Divides two values.', 95] + [Math, //, FloorDivide, 'Divides two values and floors the result.', 95] + [Math, mod, Modulo, 'Divides two values and returns the remainder.', 95] + [Math, **, Pow, 'Raises one value to the power of another.', 100] + [Math, ++, Concatenate, 'Concatenates two lists, two strings, or two binary values.', 80] + [Bitwise, bit-or, BitOr, 'Performs a bitwise OR on two values.', 60] + [Bitwise, bit-xor, BitXor, 'Performs a bitwise XOR on two values.', 70] + [Bitwise, bit-and, BitAnd, 'Performs a bitwise AND on two values.', 75] + [Bitwise, bit-shl, ShiftLeft, 'Bitwise shifts a value left by another.', 85] + [Bitwise, bit-shr, ShiftRight, 'Bitwise shifts a value right by another.', 85] + [Boolean, or, Or, 'Checks if either value is true.', 40] + [Boolean, xor, Xor, 'Checks if one value is true and the other is false.', 45] + [Boolean, and, And, 'Checks if both values are true.', 50] + [Boolean, not, Not, 'Negates a value or expression.', 55] + ] +} def "nu-complete list-aliases" [] { scope aliases | select name description | rename value description