Skip to content

add a new sigil % for built-ins like ^ is a sigil for externals - #17956

Merged
fdncred merged 3 commits into
nushell:mainfrom
fdncred:add_builtin_sigil
Apr 3, 2026
Merged

fdncred merged 3 commits into
nushell:mainfrom
fdncred:add_builtin_sigil

Conversation

@fdncred

@fdncred fdncred commented Apr 1, 2026 •

Copy link
Copy Markdown
Contributor

This PR introduces a new sigil % to force a built-in to run similar to the way ^ forces an external to try and run.

Release notes summary - What our users need to know

New sigil % to explicitly call built-ins

Nushell has a new sigil % that allows you to call a built-in even if you have the built-in shadowed by a custom command or alias.

My fancy ls custom command sorts directories first.

❯ ls | first 5
╭─#─┬────name─────┬─type─┬─size──┬───modified───╮
│ 0 │   assets   │ dir  │   160 │ 2 years ago  │
│ 1 │   ast-grep │ dir  │   160 │ 2 months ago │
│ 2 │   benches  │ dir  │   128 │ 2 weeks ago  │
│ 3 │   clippy   │ dir  │    96 │ a year ago   │
│ 4 │   crates   │ dir  │ 1,472 │ 2 weeks ago  │
╰─#─┴────name─────┴─type─┴─size──┴───modified───╯

Now you can call the built-in even if you have your built-in shadowed as above.

❯ %ls | first 5
╭─#─┬─────────name──────────┬─type─┬──size───┬───modified───╮
│ 0 │ *  CITATION.cff       │ file │     812 │ 2 years ago  │
│ 1 │   CODE_OF_CONDUCT.md │ file │   3,444 │ a year ago   │
│ 2 │   CONTRIBUTING.md    │ file │  18,387 │ 2 months ago │
│ 3 │   Cargo.lock         │ file │ 245,738 │ 2 days ago   │
│ 4 │   Cargo.toml         │ file │  11,601 │ 2 days ago   │
╰─#─┴─────────name──────────┴─type─┴──size───┴───modified───╯

If you try to call something that doesn't exist as a built-in you get an error.

❯ %lss
Error: nu::parser::error

  × percent sigil requires a built-in command
   ╭─[repl_entry #4:1:2]
 1 │ %lss
   ·  ─┬─
   ·   ╰── unknown built-in command
   ╰────
  help: remove `%` to use normal resolution, or use `^` to run an external command explicitly

Tasks after submitting

@github-actions github-actions Bot added A:parser Issues related to parsing A:std-library Defining and improving the standard library written in Nu labels Apr 1, 2026
@fdncred fdncred added notes:ready Indicates Ready for Release notes notes:additions Noted in "Additions" section and removed A:parser Issues related to parsing A:std-library Defining and improving the standard library written in Nu labels Apr 1, 2026
@cptpiepmatz
cptpiepmatz self-requested a review April 1, 2026 15:55
Comment thread crates/nu-cli/tests/completions/mod.rs Resolved
Comment thread crates/nu-cli/tests/completions/mod.rs Resolved
Comment thread crates/nu-parser/src/parser.rs Resolved
@fdncred

fdncred commented Apr 2, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @blindFS. I updated the tests and added more comments around the other point.

Comment thread crates/nu-parser/tests/test_parser.rs Resolved
Comment thread crates/nu-parser/src/parser.rs Resolved
@cptpiepmatz

Copy link
Copy Markdown
Member

I updated some of the tests you touched to use the convenience methods of the NuTester and some rstest to reduce code duplication.

@fdncred
fdncred merged commit c869941 into nushell:main Apr 3, 2026
17 checks passed
@fdncred
fdncred deleted the add_builtin_sigil branch April 3, 2026 15:37
@github-actions github-actions Bot added this to the v0.112.0 milestone Apr 3, 2026
Comment thread crates/nu-parser/src/parser.rs Resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

notes:additions Noted in "Additions" section notes:ready Indicates Ready for Release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants