Skip to content

run cargo update to reduce the size of Cargo.lock - #8

Closed
WindSoilder wants to merge 1 commit into
fdncred:update_to_ratatui030from
WindSoilder:update_to_ratatui030
Closed

WindSoilder wants to merge 1 commit into
fdncred:update_to_ratatui030from
WindSoilder:update_to_ratatui030

Conversation

@WindSoilder

Copy link
Copy Markdown

No description provided.

@WindSoilder
WindSoilder deleted the update_to_ratatui030 branch January 29, 2026 06:03
fdncred added a commit that referenced this pull request May 6, 2026
## Description

This PR adds dynamic builtin dispatch for the percent sigil so users can
write:

- %($cmd) arg1 arg2
- %$cmd arg1 arg2

Previously, percent dispatch only worked when the command name was
statically known at parse time. With this change, the builtin name can
come from a runtime expression while still preserving percent semantics:
resolve and run builtin commands only.

<!--
Explain what this PR does and why.

This section is intentionally flexible:
- Describe the problem
- Explain your approach
- Include technical details if relevant

Good examples:
- "In this PR, I fixed..."
- "In this PR, I added support for..."
- "This change improves X by..."

Write as much or as little as needed for reviewers to understand your
changes.
-->

## User-facing changes (Release notes)

Nushell now supports dynamic percent builtin dispatch with forms like
%($cmd) and %$cmd.

This preserves percent safety semantics while allowing runtime command
selection:

- only builtins are eligible targets
- non-builtin/custom/alias targets are rejected
- arguments are forwarded as parsed values (not string-evaluated like
shell eval)

This should work very similarly to dynamic dispatch of externals. The
same model was followed to implement it.

Here's a couple examples that are also tests.
### Built-ins resolve
```nushell
❯ let cmd = 'echo'; %$cmd 'hello'
hello
❯ %('echo') 'world'
world
❯ let cmd = 'echo'; %($cmd) 'hello'
hello
```
### Missing commands fail
```nushell
❯ let cmd = 'my_nonexistent_cmd'; %($cmd)
Error: nu::shell::command_not_found

  × Command not found
   ╭─[repl_entry #7:1:33]
 1 │ let cmd = 'my_nonexistent_cmd'; %($cmd)
   ·                                 ───┬───
   ·                                    ╰── command not found
   ╰────
```
### Custom commands aren't built-in commands so they fail too
```nushell
❯ def custom_cmd [] { 'nope' }; let cmd = 'custom_cmd'; %($cmd)
Error: nu:🐚:command_not_found

  × Command not found
   ╭─[repl_entry #8:1:55]
 1 │ def custom_cmd [] { 'nope' }; let cmd = 'custom_cmd'; %($cmd)
   ·                                                       ───┬───
   ·                                                          ╰── command not found
   ╰────
```

<!--
This section is used (mostly as-is) for https://www.nushell.sh/blog/

Describe how Nushell behavior changes from a user's perspective.
Do NOT describe internal Rust changes here.

Write in a release note style, for example:
- "Added support for..."
- "Fixed an issue where..."
- "Nushell now supports..."
- "Improved performance of..."

If your changes do NOT affect users (internal refactors, cleanup, etc.),
just write:
- "n/a"
- "nan"
- or similar

This tells us the change should not appear in the changelog.

Tips:
- Focus on observable behavior
- Include examples if helpful
- Keep it concise

You can:
- Write a short paragraph (will appear as a bullet point), OR
- Use headings (###) if your change needs more structure

Avoid writing things like:
- "In this PR, I refactored..."
- "This updates internal code..."

You may leave this blank until the PR is ready.
-->

## Additional notes
closes nushell#18150
<!--
Optional.

Examples:
- fixes nushell#123
- closes nushell#456
- related nushell#789

Anything else reviewers should know.
Remove this section if not needed.
-->
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.

1 participant