forked from nushell/nushell.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add command signature section (nushell#671)
* add command signature section * update doc * Update book/command_signature.md Co-authored-by: Stefan Holderbach <[email protected]> * Update book/command_signature.md Co-authored-by: Stefan Holderbach <[email protected]> * Update book/programming_in_nu.md Co-authored-by: Stefan Holderbach <[email protected]>
- Loading branch information
1 parent
2898aa2
commit dca2e83
Showing
3 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Command signature | ||
|
||
nu commands contains a signature section, take `str distance` as example, the signature is like this: | ||
|
||
``` | ||
Signatures(Cell paths are supported): | ||
<string> | str distance <string> -> <int> | ||
``` | ||
|
||
The first type name before `|` describes the type of input pipeline. The command name is followed by the required argument type(s) for the command. The output type is `int` and given after `->`. | ||
|
||
`(Cell paths are supported)` indicates that you can provide cell paths for `str distance` to apply an operation at the given cell path(s) in a nested structure or table, and replace the column or field with the result, like: `ls | str distance 'nushell' 'name'` | ||
|
||
Here is another one example, `str join`: | ||
|
||
``` | ||
Signatures: | ||
list<string> | str join <string?> -> <string> | ||
``` | ||
|
||
It says that `str join` command expect input pipeline is a list of string, and take optional `string` type argument, finally the output type is `string`. | ||
|
||
Some commands don't accept or require data through the input pipeline, thus the input type will be `<nothing>`. | ||
The same is true for the output type if the command returns `null` (e.g. `rm`). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters