nushell/crates/nu-std
Kamil ca275f59da
Added assert not command (assertion that the value/expression is false) (#9235)
# Description
A new command to simplify assertions for `false`.

The name is just a draft, though I could not come up with a better name.
I have rejected `assert false`, because I would have to rename `assert`
to `assert true` which would break the compatibility and worsen the
shell experience of the good old `assert`.

Another idea I have rejected was something like `assert_false` to keep
it consistent with the naming convention of our stdlib.

I am open to suggestions :)

# User-Facing Changes
Just a new command

# Tests + Formatting
- [x] Done

# After Submitting
<!-- If your PR had any user-facing changes, update [the
documentation](https://github.com/nushell/nushell.github.io) after the
PR is merged, if necessary. This will help us keep the docs up to date.
-->
2023-05-19 11:33:19 +02:00
..
lib Added assert not command (assertion that the value/expression is false) (#9235) 2023-05-19 11:33:19 +02:00
src REFACTOR: remove the shell commands (#8415) 2023-05-13 12:40:11 -05:00
tests Added assert not command (assertion that the value/expression is false) (#9235) 2023-05-19 11:33:19 +02:00
Cargo.toml bump nushell from release version to development version (#9215) 2023-05-17 07:59:01 -05:00
CONTRIBUTING.md refactor the CONTRIBUTING.md guidelines for nu-std (#8912) 2023-04-19 22:21:27 +02:00
LICENSE add LICENSE to nu-std (#8803) 2023-04-07 13:39:21 -07:00
README.md refactor the CONTRIBUTING.md guidelines for nu-std (#8912) 2023-04-19 22:21:27 +02:00

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
> help commands | select name usage | where name =~ "std "
╭────┬─────────────────────────────┬────────────────────────────────────────────────────────────────╮
│  # │            name             │                                usage                           │
├────┼─────────────────────────────┼────────────────────────────────────────────────────────────────┤
│  0 │ std assert                  │ Universal assert command                                       │
│  1 │ std assert equal            │ Assert $left == $right                                         │
           . . .
│ 11 │ std clip                    │ put the end of a pipe into the system clipboard.               │
│ 12 │ std dirs add                │ Add one or more directories to the list.                       │
           . . .
├────┼─────────────────────────────┼────────────────────────────────────────────────────────────────┤
│  # │            name             │                                usage                           │
╰────┴─────────────────────────────┴────────────────────────────────────────────────────────────────╯

🧰 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