Skip to content

Document the percent sigil#2167

Open
samoylovfp wants to merge 1 commit into
nushell:mainfrom
samoylovfp:main
Open

Document the percent sigil#2167
samoylovfp wants to merge 1 commit into
nushell:mainfrom
samoylovfp:main

Conversation

@samoylovfp
Copy link
Copy Markdown
Contributor

Fixes #2166

Is the example too convoluted? Maybe just

let cmd = "is-empty"
[ 1 ] | %$cmd

?

@Juhan280
Copy link
Copy Markdown
Contributor

Primary use case for % is to call builtins that are overriden by other custom command.

alias cd = __zoxide_z
%cd some_dir # can be used to run builtin cd

This can also be used for wrapping a builtin command with the same name

def ls [] {
  %ls | sort-by size
}

```nu

[[cmd]; ["any"] ["all"]]
| insert result {|row| [1 2 3] | %$row.cmd {$in == 2}}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't a great example of why % exists. Maybe one like Juhan suggests would be better here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Percent sigil is undocumented

3 participants