2a3805c164
# Description Uses "normal" module `std/<submodule>/mod.nu` instead of renaming the files (as requested in #13842). # User-Facing Changes No user-facing changes other than in `view files` results. Imports remain the same after this PR. # Tests + Formatting - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🟢 `toolkit test` - 🟢 `toolkit test stdlib` Also manually confirmed that it does not interfere with nupm, since we did have a conflict at one point (and it's not possible to test here). # Performance Tests ## Linux ### Nushell Startup - No config ```nu bench --pretty -n 200 { <path_to>/nu -c "exit" } ``` | Release | Startup Time | | --- | --- | | 0.98.0 | 22ms 730µs 768ns +/- 1ms 515µs 942ns | This commit | 9ms 312µs 68ns +/- 709µs 378ns | Yesterday's nightly | 9ms 230µs 953ns +/- 9ms 67µs 689ns ### Nushell Startup - Load full standard library Measures relative impact of a full `use std *`, which isn't recommended, but worth tracking. ```nu bench --pretty -n 200 { <path_to>/nu -c "use std *; exit" } ``` | Release | Startup Time | | --- | --- | | 0.98.0 | 23ms 10µs 636ns +/- 1ms 277µs 854ns | This commit | 26ms 922µs 769ns +/- 562µs 538ns | Yesterday's nightly | 28ms 133µs 95ns +/- 761µs 943ns | `deprecated_dirs` removal PR * | 23ms 610µs 333ns +/- 369µs 436ns \* Current increase is partially due to double-loading `dirs` with removal warning in older version. # After Submitting Still TODO - Update standard library doc |
||
---|---|---|
.. | ||
src | ||
std | ||
tests | ||
Cargo.toml | ||
CONTRIBUTING.md | ||
LICENSE | ||
README.md | ||
testing.nu |
Welcome to the standard library of `nushell`!
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:
> 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
... ...
─┴───────────────────────────┴─────────────────────────────────────────────────
🧰 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
command.
You can choose to import the whole module, but then must refer to individual commands with a std
prefix, e.g:
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.
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.
✏️ contribute to the standard library
You're invited to contribute to the standard library! See CONTRIBUTING.md for details