W3cubDocs

/Nushell

export def for core

Define a custom command and export it from a module.

Signature

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

Parameters

  • name: definition name
  • params: parameters
  • block: body of the definition

Input/output types:

input output
nothing nothing

Examples

Define a custom command in a module and call it

>modulespam { export deffoo [] { "foo" } };usespamfoo;foo
foo

Notes

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

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