mirror of
https://github.com/nushell/nushell.git
synced 2024-12-01 04:43:48 +01:00
95b78eee25
# Description The meaning of the word usage is specific to describing how a command function is *used* and not a synonym for general description. Usage can be used to describe the SYNOPSIS or EXAMPLES sections of a man page where the permitted argument combinations are shown or example *uses* are given. Let's not confuse people and call it what it is a description. Our `help` command already creates its own *Usage* section based on the available arguments and doesn't refer to the description with usage. # User-Facing Changes `help commands` and `scope commands` will now use `description` or `extra_description` `usage`-> `description` `extra_usage` -> `extra_description` Breaking change in the plugin protocol: In the signature record communicated with the engine. `usage`-> `description` `extra_usage` -> `extra_description` The same rename also takes place for the methods on `SimplePluginCommand` and `PluginCommand` # Tests + Formatting - Updated plugin protocol specific changes # After Submitting - [ ] update plugin protocol doc
48 lines
2.2 KiB
Markdown
48 lines
2.2 KiB
Markdown
<h1 align="center">
|
|
Welcome to the standard library of `nushell`!
|
|
<img src="https://media.giphy.com/media/hvRJCLFzcasrR4ia7z/giphy.gif" width="28"></img>
|
|
</h1>
|
|
|
|
The standard library is a pure-`nushell` collection of custom commands which
|
|
provide interactive utilities and building blocks for users writing casual scripts or complex applications.
|
|
|
|
To see what's here:
|
|
```text
|
|
> use std
|
|
> scope commands | select name description | where name =~ "std "
|
|
#┬───────────name────────────┬───────────────────description───────────────────
|
|
0│std assert │Universal assert command
|
|
1│std assert equal │Assert $left == $right
|
|
2│std assert error │Assert that executing the code generates an error
|
|
3│std assert greater │Assert $left > $right
|
|
4│std assert greater or equal│Assert $left >= $right
|
|
... ...
|
|
─┴───────────────────────────┴─────────────────────────────────────────────────
|
|
```
|
|
|
|
## :toolbox: Using the standard library in the REPL or in scripts
|
|
All commands in the standard library must be "imported" into the running environment
|
|
(the interactive read-execute-print-loop (REPL) or a `.nu` script) using the
|
|
[`use`](https://nushell.sh/commands/docs/use.html) command.
|
|
|
|
You can choose to import the whole module, but then must refer to individual commands with a `std` prefix, e.g:
|
|
```nushell
|
|
use std
|
|
|
|
std log debug "Running now"
|
|
std assert (1 == 2)
|
|
```
|
|
Or you can enumerate the specific commands you want to import and invoke them without the `std` prefix.
|
|
```nushell
|
|
use std ["log debug" assert]
|
|
|
|
log debug "Running again"
|
|
assert (2 == 1)
|
|
```
|
|
This is probably the form of import you'll want to add to your `env.nu` for interactive use.
|
|
|
|
## :pencil2: contribute to the standard library
|
|
You're invited to contribute to the standard library! See [CONTRIBUTING.md] for details
|
|
|
|
[CONTRIBUTING.md]: https://github.com/nushell/nushell/blob/main/crates/nu-std/CONTRIBUTING.md
|