Open moondev opened 3 years ago
Comment from the sideline.
We also use tusk
mostly to wrap other tools. However, from my point of view, this suggestion is problematic, because perhaps one of the most useful feature of tusk
over other tools is the explicit declaration of options, including very good auto-completion and the possibility to write usage strings. This ensures that the task file is self-descriptive, needs minimal documentation, and is easy to use for multiple team members.
Allowing a variadic pass-through, espcially when it comes to options is encoring a pattern that favors simple tusk files over usability, which in my own opinion, is removing most of the benefits of using tusk in the first place. If this is how most tasks will look like, you might consider a shell script.
Allowing the last listed argument to be variadic though (similar to Go functions) is probably a nice thought, if not one I have often seen a need for.
Another alternative i've used is passing the args and commands as an string, bash -c
style
tasks:
kind:
options:
cmd:
short: c
run:
- go run sigs.k8s.io/kind@latest ${cmd}
this handles tusk kind
and tusk kind -c 'create cluster --name my-cluster'
but tusk kind create cluster ...
would be more intuitive.
Curious if something like kubectl
uses with --
is relevant here: kubectl exec -it some-pod -- cat /etc/os-release
First of all, just want to thank you for
tusk
! It's been a pleasure to use and is now a main component of my workflow. With upcominggo run
support in 1.17.x for import paths it can run bash style via a shebang.My feature request is for "variadic style" tasks, that is, the ability to define a task with an arbitrary number of options and/or arguments, similar to this example: https://gobyexample.com/variadic-functions
My use-case for this is I often define tasks as a wrapper of sorts for another program, such as this example for
kind
./tusk.yaml kind
runskind
but in order to pass arguments and options I would need to define them all. For non user-exposed tasks i've been using global options which works well enoughHowever it would be handy to be able to expose a command that just passes everything through, this way tasks could be easily defined as a proxy of sorts for a program
This could enable easily using a task like it was the original program without needing to define everything
Interested in your thoughts on this, thanks again!