mirror of
https://github.com/nushell/nushell
synced 2024-12-26 21:13:19 +00:00
Revert "Remove unnecessary get-all-operators
in std lib with help operators
"
This reverts commit fc48357cb9
.
This commit is contained in:
parent
fc48357cb9
commit
8bdabd2be5
1 changed files with 42 additions and 2 deletions
|
@ -32,6 +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 [
|
||||||
|
[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 "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
|
||||||
}
|
}
|
||||||
|
@ -42,7 +82,7 @@ def "nu-complete list-modules" [] {
|
||||||
|
|
||||||
def "nu-complete list-operators" [] {
|
def "nu-complete list-operators" [] {
|
||||||
let completions = (
|
let completions = (
|
||||||
help operators
|
get-all-operators
|
||||||
| select name description
|
| select name description
|
||||||
| rename value description
|
| rename value description
|
||||||
)
|
)
|
||||||
|
@ -424,7 +464,7 @@ export def operators [
|
||||||
...operator: string@"nu-complete list-operators" # the name of operator to get help on
|
...operator: string@"nu-complete list-operators" # the name of operator to get help on
|
||||||
--find (-f): string # string to find in operator names
|
--find (-f): string # string to find in operator names
|
||||||
] {
|
] {
|
||||||
let operators = (help operators)
|
let operators = (get-all-operators)
|
||||||
|
|
||||||
if not ($find | is-empty) {
|
if not ($find | is-empty) {
|
||||||
$operators | find $find --columns [type name]
|
$operators | find $find --columns [type name]
|
||||||
|
|
Loading…
Reference in a new issue