if you're ok with externals you can also use [dollarg] from iemlib or [canvasargs] from iemguts. for a hacky vanilla solution, see attached patch. I'm sure there are more ways, this is just one that I remembered.
And it is a nice one, Thanks Christof! P