Spec-Zone.ru › Nushell

export def for core

Define a custom command and export it from a module.

Signature

> export def {flags} (def_name) (params) (block)

Flags

  • --env: Environment: defined inside the command.
  • --wrapped: Unknown flags and arguments: strings that require rest-like parameter in signature.

Parameters

  • def_name: Command name to define.
  • params: Command parameters: comma-separated list inside [].
  • block: Command body: list of instructions inside {}.

Input/output types:

input output
nothing nothing

Examples

Define a custom command in a module and call it.

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

Notes

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

Copyright © 2019–2026 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/export_def.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API