-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Aliases should support variable arguments or 'rest' arguments #1716
Copy link
Copy link
Closed
Labels
category:enhancementNew feature or requestNew feature or request
Description
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:
aws-vault exec <my-profile> -- <some command>
I tried to create an alias like this:
alias kaws [cmd] { aws-vault exec <my-profile> -- $cmd }
But this will only capture one 'word'. For example, this fails:
kaws aws s3 ls
error: kaws unexpected s3
- shell:1:14
1 | kaws aws s3 ls
| ^^ unexpected argument (try kaws -h)
Describe the solution you'd like
I'd need a way to describe a parameter which captures multiple inputs.
Maybe something like:
alias kaws [...cmd] { aws-vault exec <my-profile> -- $cmd }
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.
alias kaws [arg1 arg2 arg3 arg4 arg5] { .... }
kaws aws s3 ls
error: Alias failed to run
- shell:1:14
1 | kaws aws s3 ls
| ^^^^ alias failed to run
- shell:1:14
1 | kaws aws s3 ls
| ---- Type Error
(expected:
string,
actual:
nothing)
Additional context
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
category:enhancementNew feature or requestNew feature or request