Home Explore Blog CI



nushell

2nd chunk of `book/standard_library.md`
a2f7ed229bd69386bf033f60cc103717e58631115b7b56a6000000010000096a
- `use std/math`: Mathematical constants such as `$math.E`. These can also be imported as definitions as in Form #2 below.

#### 2. Import the _definitions_ (contents) of the module directly

Some submodules are easier to use when their definitions (commands, aliases, constants, etc.) are loaded into the current scope. For instance:

```nu
use std/formats *
ls | to jsonl
```

Submodules that are normally imported with `use std/<submodule> *` (**with** a glob/`*`):

- `use std/dt *`: Additional commands for working with `date` values
- `use std/formats *`: Additional `to` and `from` format conversions
- `use std/math *`: The math constants without a prefix, such as `$E`. Note that the prefixed form #1 above is likely more understandable when reading and maintaining code.
- `use std/xml *`: Additional commands for working with XML data

#### 3. `use std <submodule>`

It is _possible_ to import Standard Library submodules using a space-separated form:

```nu
use std log
use std formats *
```

::: important
As mentioned in [Using Modules](./modules/using_modules.md#module-definitions), this form (like `use std *`) first loads the _entire_ Standard Library into scope and _then_ imports the submodules. In contrast, the slash-separated versions in #1 and #2 above _only_ import the submodule and will be much faster as a result.
:::

## The Standard Library Candidate Module

`std-rfc`, found in the [nushell Repository](https://github.com/nushell/nushell/tree/main/crates/nu-std/std-rfc), serves as a staging ground for possible Standard Library additions.

If you are interested in adding to the Standard Library, please submit your code via PR to the `std-rfc` module in that repository. We also encourage you to install this module and provide feedback on upcoming candidate commands.

::: details More details

Candidate commands for the Standard Library should, in general:

- Have broad appeal - Be useful to a large number of users or use cases
- Be well-written and clearly commented for future maintainers
- Implement help comments with example usage
- Have a description that explains why you feel the command should be a part of the standard library. Think of this as an "advertisement" of sorts to convince people to try the command and provide feedback so that it can be promoted in the future.

In order for a command to be graduated from RFC to the Standard Library, it must have:

Title: Importing Standard Library Submodules and Candidate Modules
Summary
There are multiple ways to import Standard Library submodules in Nushell. Some submodules are imported with `use std/<submodule>` (like `use std/assert`), while others are imported with `use std/<submodule> *` to load their definitions directly into the current scope (like `use std/formats *`). It is possible to import submodules using the form `use std <submodule>`, but this first loads the entire standard library into scope. `std-rfc`, found in the nushell repository, is a staging ground for possible additions to the Standard Library.