Nushell
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
GitHub
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
GitHub
  • Categories

    • Bits
    • Bytes
    • Chart
    • Conversions
    • Core
    • Database
    • Dataframe
    • Dataframe Or Lazyframe
    • Date
    • Debug
    • Default
    • Env
    • Experimental
    • Expression
    • Filesystem
    • Filters
    • Formats
    • Generators
    • Hash
    • History
    • Lazyframe
    • Math
    • Misc
    • Network
    • Path
    • Platform
    • Plugin
    • Prompt
    • Random
    • Removed
    • Shells
    • Strings
    • System
    • Viewers

use for core

Use definitions from a module, making them available in your shell.

Signature

> use {flags} (module) ...rest

Parameters

  • module: Module or module file (null for no-op).
  • ...rest: Which members of the module to import.

Input/output types:

inputoutput
nothingnothing

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 [] { $env.FOO_BAR = "BAZ" } }; use foo bar; bar; $env.FOO_BAR
BAZ

Use a plain module name to import its definitions qualified by the module name

> module spam { export def foo [] { "foo" }; export def bar [] { "bar" } }; use spam; (spam foo) + (spam bar)
foobar

Specify * to use all definitions in a module

> module spam { export def foo [] { "foo" }; export def bar [] { "bar" } }; use spam *; (foo) + (bar)
foobar

To use commands with spaces, like subcommands, surround them with quotes

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

To use multiple definitions from a module, wrap them in a list

> module spam { export def foo [] { "foo" }; export def 'foo bar' [] { "baz" } }; use spam ['foo', 'foo bar']; (foo) + (foo bar)
foobaz

Notes

See help std for the standard library module. See help modules to list all available modules.

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