Optional arguments
Aaron Bentley
aaron.bentley at utoronto.ca
Thu Jul 13 04:46:35 BST 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On a related note:
I've got a command (bzrtools shove) that would like to do
TAKES_ARGS=['source?', 'target']
The behaviour would be:
[] => ERROR
['TAR'] => {'target': 'TAR'}
['SRC', 'TAR'] => {source:'SRC', target:'TAR'}
Do you think that permitting optional arguments to occur before required
arguments makes sense? I've currently solved this by taking arguments
in the reverse order: takes_args = ['target', 'source?'], but this isn't
intuitive since it's different from commands such as branch.
The other option would be to change the command, so that you can omit an
argument when it's run in the target directory, not the source.
Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFEtcIb0F+nu1YWqI0RAjgPAJ9uX24HYRkAWfOHcX3meyDyHVeOhgCfXFAx
D5Au/JQdmaEamwTWdSYuEZw=
=8uPK
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list