use for core

Use definitions from a module.

Signature

> use (module) (members)

Parameters

  • module: Module or module file
  • members: Which members of the module to import

Notes

This command is a parser keyword. For details, check: https://www.nushell.sh/book/thinking_in_nu.html

Examples

Define a custom command in a module and call it

> module spam { export def foo [] { "foo" } }; use spam foo; foo
foo

Define a custom command that participates in the environment in a module and call it

> module foo { export def-env bar [] { let-env FOO_BAR = "BAZ" } }; use foo bar; bar; $env.FOO_BAR
BAZ