Spec-Zone.ru › Nushell

view source for debug

View a block, module, or a definition.

Signature

> view source {flags} (item)

Parameters

  • item: Name or block to view.

Input/output types:

input output
nothing string

Examples

View the source of a code block.

> let abc = {|| echo 'hi' }; view source $abc
{|| echo 'hi' }

View the source of a custom command.

> def hi [] { echo 'Hi!' }; view source hi
def hi [] { echo 'Hi!' }

View the source of a custom command, which participates in the caller environment.

> def --env foo [] { $env.BAR = 'BAZ' }; view source foo
def --env foo [] { $env.BAR = 'BAZ' }

View the source of a custom command with flags.

> def --wrapped --env foo [...rest: string] { print $rest }; view source foo
def --env --wrapped foo [ ...rest: string] { print $rest }

View the source of a custom command with flags and arguments.

> def test [a?:any --b:int ...rest:string] { echo 'test' }; view source test
def test [ a?: any --b: int ...rest: string] { echo 'test' }

View the source of a module.

> module mod-foo { export-env { $env.FOO_ENV = 'BAZ' } }; view source mod-foo
 export-env { $env.FOO_ENV = 'BAZ' }

View the source of an alias.

> alias hello = echo hi; view source hello
echo hi

View the file where a definition lives via metadata.

> view source some_command | metadata

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

Spec-Zone.ru

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