[RFC] Optparse option handling

Aaron Bentley aaron.bentley at utoronto.ca
Fri Aug 4 04:13:21 BST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all,

I've updated the optparse branch, added unit tests and the like.  The
branch now

* uses optparse to parse options, and to generate help

* auto-supplies negations of all booleans.  That is, --strict implies
  --no-strict, and --no-recurse implies --recurse.

* provides enumerated options.  These are options where several switches
 affect the same variable.  These replace options like --merge-type and
- --short.  The last value is always used.

* updates log, merge, remerge, init-repo, init, upgrade to use EnumOptions

* Uses polymorphism to provide different behavior for Option and EnumOption

* Groups enumerations in the help output, provides textual descriptions
of all options.

The downside is that the old parameters have been removed, instead of
being deprecated.  Supporting looks looks like pain, but if it's felt
that we must support e.g. --merge-type as a deprecated option for 0.10,
then I will figure out how to support it.

So can I get some comments on where to go from here?

Aaron
p.s. Here's the help output of init-repository, for an example:

help:usage: bzr init-repository LOCATION
aliases: init-repo

Create a shared repository to hold branches.

New branches created under the repository directory will store their
revisions
in the repository, not in the branch directory, if the branch format
supports
shared storage.

example:
    bzr init-repo repo
    bzr init repo/trunk
    bzr checkout --lightweight repo/trunk trunk-checkout
    cd trunk-checkout
    (add files here)

options:
  -h, --help     show help message
  --trees        Allows branches in repository to have a working tree

  Repository Format:
    --default    The current best format (knit)
    --knit       0.8+ append-only format
    --metaweave  0.8 transitional format
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD4DBQFE0rtR0F+nu1YWqI0RAlzNAJd4LhPbqzaOC9tspahj7OKsx/K6AJ9THtMY
z5RGu6TcCCmtkXnNZYpK8w==
=zlQB
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: optparse.patch
Type: text/x-patch
Size: 39731 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060803/6d72e951/attachment.bin 


More information about the bazaar mailing list