Update std help operators

This commit is contained in:
Ian Manske 2024-11-24 16:06:37 -08:00
parent 8bdabd2be5
commit f84831b896

View file

@ -32,45 +32,46 @@ def command-not-found-error [span: record] {
throw-error "std::help::command_not_found" "command not found" $span throw-error "std::help::command_not_found" "command not found" $span
} }
def get-all-operators [] { return [ def get-all-operators [] {
[
[type, operator, name, description, precedence]; [type, operator, name, description, precedence];
[Assignment, =, Assign, 'Assigns a value to a variable.', 10]
[Assignment, =, Assign, "Assigns a value to a variable.", 10] [Assignment, +=, AddAssign, 'Adds a value to a variable.', 10]
[Assignment, +=, PlusAssign, "Adds a value to a variable.", 10] [Assignment, -=, SubtractAssign, 'Subtracts a value from a variable.', 10]
[Assignment, ++=, ConcatAssign, "Concatenate two lists, two strings, or two binary values.", 10] [Assignment, *=, MultiplyAssign, 'Multiplies a variable by a value.', 10]
[Assignment, -=, MinusAssign, "Subtracts a value from a variable.", 10] [Assignment, /=, DivideAssign, 'Divides a variable by a value.', 10]
[Assignment, *=, MultiplyAssign, "Multiplies 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]
[Assignment, /=, DivideAssign, "Divides a variable by a value.", 10] [Comparison, ==, Equal, 'Checks if two values are equal.', 80]
[Comparison, ==, Equal, "Checks if two values are equal.", 80] [Comparison, !=, NotEqual, 'Checks if two values are not equal.', 80]
[Comparison, !=, NotEqual, "Checks if two values are not equal.", 80] [Comparison, <, LessThan, 'Checks if a value is less than another.', 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, <=, 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, >=, 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 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, '!~ 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, 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, is not part of a string, or is not a key in a record.', 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, starts-with, StartsWith, "Checks if a string starts with another.", 80] [Comparison, ends-with, EndsWith, 'Checks if a string ends with another.', 80]
[Comparison, ends-with, EndsWith, "Checks if a string ends with another.", 80] [Math, +, Add, 'Adds two values.', 90]
[Comparison, not, UnaryNot, "Negates a value or expression.", 0] [Math, -, Subtract, 'Subtracts two values.', 90]
[Math, +, Plus, "Adds two values.", 90] [Math, *, Multiply, 'Multiplies two values.', 95]
[Math, ++, Concat, "Concatenate two lists, two strings, or two binary values.", 80] [Math, /, Divide, 'Divides two values.', 95]
[Math, -, Minus, "Subtracts two values.", 90] [Math, //, FloorDivide, 'Divides two values and floors the result.', 95]
[Math, *, Multiply, "Multiplies two values.", 95] [Math, mod, Modulo, 'Divides two values and returns the remainder.', 95]
[Math, /, Divide, "Divides two values.", 95] [Math, **, Pow, 'Raises one value to the power of another.', 100]
[Math, //, FloorDivision, "Divides two values and floors the result.", 95] [Math, ++, Concatenate, 'Concatenates two lists, two strings, or two binary values.', 80]
[Math, mod, Modulo, "Divides two values and returns the remainder.", 95] [Bitwise, bit-or, BitOr, 'Performs a bitwise OR on two values.', 60]
[Math, **, "Pow ", "Raises one value to the power of another.", 100] [Bitwise, bit-xor, BitXor, 'Performs a bitwise XOR on two values.', 70]
[Bitwise, bit-or, BitOr, "Performs a bitwise OR on two values.", 60] [Bitwise, bit-and, BitAnd, 'Performs a bitwise AND on two values.', 75]
[Bitwise, bit-xor, BitXor, "Performs a bitwise XOR on two values.", 70] [Bitwise, bit-shl, ShiftLeft, 'Bitwise shifts a value left by another.', 85]
[Bitwise, bit-and, BitAnd, "Performs a bitwise AND on two values.", 75] [Bitwise, bit-shr, ShiftRight, 'Bitwise shifts a value right by another.', 85]
[Bitwise, bit-shl, ShiftLeft, "Shifts a value left by another.", 85] [Boolean, or, Or, 'Checks if either value is true.', 40]
[Bitwise, bit-shr, ShiftRight, "Shifts a value right by another.", 85] [Boolean, xor, Xor, 'Checks if one value is true and the other is false.', 45]
[Boolean, and, And, "Checks if two values are true.", 50] [Boolean, and, And, 'Checks if both values are true.', 50]
[Boolean, or, Or, "Checks if either value is true.", 40] [Boolean, not, Not, 'Negates a value or expression.', 55]
[Boolean, xor, Xor, "Checks if one value is true and the other is false.", 45] ]
]} }
def "nu-complete list-aliases" [] { def "nu-complete list-aliases" [] {
scope aliases | select name description | rename value description scope aliases | select name description | rename value description