Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add apply command #9098

Closed
wants to merge 1 commit into from
Closed

Add apply command #9098

wants to merge 1 commit into from

Conversation

pingiun
Copy link
Contributor

@pingiun pingiun commented May 4, 2023

Description

Fixes #7758

Adds a new command to call internal or external commands with arbitrary arguments.

Usage example:

let commandname = "sl"
let args = []
apply $commandname $args

User-Facing Changes

Add a new command

Tests + Formatting

This is a WIP, tests will be added later

After Submitting

This will need some nice documentation

@pingiun pingiun marked this pull request as draft May 4, 2023 15:38
@kubouch
Copy link
Contributor

kubouch commented May 6, 2023

Thanks for looking into it. This will work for external commands but to make it work with internal commands, you'd need to make apply a parser keyword and then figure out how to pass flags to it with type checking -- this would need some additional design.

Since external commands were solved by allowing blocks to extern, the remaining problem is how to pass flags to internal commands. With the core team, we settled on allowing "traditional" call syntax (e.g., foo --bar would be equal to foo(bar: true), I wrote it up here: #9116.

Also for externals, you can use ^$commandname $args, seems like apply is not necessary in this case.

@fdncred
Copy link
Collaborator

fdncred commented Jun 3, 2023

@pingiun Were you going to try to work within Kubouch's comments or should we close this for now?

@pingiun
Copy link
Contributor Author

pingiun commented Jun 3, 2023 via email

@fdncred
Copy link
Collaborator

fdncred commented Jun 3, 2023

ok, thanks. we appreciate you trying to make nushell better!!!

@fdncred fdncred closed this Jun 3, 2023
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.

How to pass variable length of arguments to other commands
4 participants