W3cubDocs

/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

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

View the source of a custom command

>defhi [] { echo'Hi!' };view sourcehi
defhi [] { echo'Hi!' }

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

>def-envfoo [] { $env.BAR='BAZ' };view sourcefoo
deffoo [] { $env.BAR='BAZ' }

View the source of a custom command with flags and arguments

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

View the source of a module

>modulemod-foo { export-env { $env.FOO_ENV='BAZ' } };view sourcemod-foo
export-env { $env.FOO_ENV='BAZ' }

View the source of an alias

>aliashello=echohi;viewsourcehello
echohi

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