[twill] Variable expansion [PATCH]

Jeff Martin jeff at mkodo.com
Fri Mar 3 08:48:39 PST 2006

Don't know if I've just reinvented the wheel, but here's a patch which
implements expansion of variables within command arguments. e.g.

setlocal hostname example.com
setlocal moreurl abitmoreurl

go http://${hostname}/someurl/${moreurl}

This uses the python eval method so you can also do things like ${var1 +
var2} to concatenate variables etc.

jeff martin
information technologist
mkodo limited

mobile: 44 (0) 78 55 478 331
phone: 44 (0) 20 77 29 45 45
email: jeff.martin at mkodo.com


73 Leonard St, London, EC2A 4QS. U.K

-------------- next part --------------
A non-text attachment was scrubbed...
Name: parse.patch
Type: text/x-patch
Size: 1336 bytes
Desc: not available
Url : http://lists.idyll.org/pipermail/twill/attachments/20060303/811707ae/parse.bin
-------------- next part --------------
setlocal foo bar

echo $foo				# bar
echo ${foo}				# bar
echo " ${foo}"				#  bar
echo "stuff ${foo} stuff"		# stuff bar stuff
echo "stuff ${bar} stuff"		# stuff ${bar} stuff
echo "stuff ${foo + 'bar'} stuff"	# stuff barbar stuff

More information about the twill mailing list