miller icon indicating copy to clipboard operation
miller copied to clipboard

[feature request] Reuse the format arguments

Open Poshi opened this issue 5 months ago • 0 comments

Dear @johnkerl,

sometimes I hit the need of using a parameter for a string format more than once:

put '$result = format("{}/{}/{}_{}.ext", $param1, $param2, $param1, $param3)'

it would be shorter and less error prone (when updating the parameters) to be able to refer to the different parameters from the format string. Something like:

put '$result = format("{1}/{2}/{1}_{3}.ext", $param1, $param2, $param3)'

This is just some syntactic sugar to avoid typing, but not a need. If you decide to follow this path, you can also consider more goodies like the ones that some other languages have: use that string inside the "{}" to also define the format to be given to the parameter being substituted. This could be a rabbit hole, so take care if following this path :-)

Thanks

Poshi avatar Sep 18 '24 10:09 Poshi