-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Aliases should support variable arguments or 'rest' arguments #1716
Comments
Here's another similar example. Alias: Error:
|
Can you try it again with #1722 and see if that helps the issue? It might take a few tries, but this approach is what seemed to make sense initially |
@jonathandturner my alias appears to be working with this change. |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
This issue has been marked stale for more than 10 days without activity. Closing this issue, but if you find that the issue is still valid, please reopen. |
What is the the status of this? Passing variables to aliases no longer appears possible. |
Custom commands is what you want. |
Custom command runs in a new scope so is not comparable.
eg. running on command line:
def mycd [dir] {cd $dir}
mycd foo
does nothing
One workaround solution would be to allow parameters to pass to the source
script invocation.
Then we could do something like (source mycd.nu) foo. (or some other
syntax) I think this does not exist at the moment or am I wrong?
I think in powershell you just do:
. mycd.ps1 foo
so sourcing with parameters is allowed.
But anyway this is a workaround it would be much better to have aliases
with parameters imo.
…On Mon, Nov 21, 2022 at 8:20 PM Darren Schroeder ***@***.***> wrote:
Custom commands is what you want.
—
Reply to this email directly, view it on GitHub
<#1716 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABQGIZX655EY7Y6VVJQ5JS3WJQUVVANCNFSM4M2AXUNQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
You're right about |
Oh, I didn't know that existed, it works!
…On Tue, Nov 22, 2022 at 8:55 AM Darren Schroeder ***@***.***> wrote:
You're right about def being scoped but if you try def-env it should work.
—
Reply to this email directly, view it on GitHub
<#1716 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABQGIZSG7LLH2LWHZRI4263WJTNGLANCNFSM4M2AXUNQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Is your feature request related to a problem? Please describe.
I want to create an alias which will basically add a prefix to a command.
Use case: I use aws-vault to run commands with the correct AWS credentials:
I tried to create an alias like this:
But this will only capture one 'word'. For example, this fails:
Describe the solution you'd like
I'd need a way to describe a parameter which captures multiple inputs.
Maybe something like:
Describe alternatives you've considered
@jonathandturner proposed creating an alias with many arguements, with the idea that arguments that are not specified are left blank. But this doesn't work.
Additional context
The text was updated successfully, but these errors were encountered: