coderofsalvation / powscript

transpiler written in bash: painless shellscript, indentbased, coffee for the shell with hipster-sparkles v1 BETA LANDED 🎉🎉🎉🎉 thanks fcard!
http://powscript.isvery.ninja/
Other
159 stars 13 forks source link

Rest arguments #52

Closed fcard closed 6 years ago

fcard commented 6 years ago

This PR introduces rest (or vararg) arguments that allows one to collect a variable number of arguments into an array:

f(a b @c)
  echo $c[@]

f 1 2 3 4 #> 3 4

k(-- x y @z)
  echo $z[@] ${z:keys}

k -x 1 -y 2 -a 3 -b 4 -c 5 #> 3 4 5 a b c
coderofsalvation commented 6 years ago

cool this is really handy to pass optional arguments