[MERGE] RegistryOption

Aaron Bentley aaron.bentley at utoronto.ca
Tue Jan 9 15:20:31 GMT 2007


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

Martin Pool wrote:
> + RegistryOption('format',
> help='Specify a format for this branch. Current'
>  ' formats are: default, knit, metaweave and' ' weave. Default is knit;
> metaweave and' ' weave are deprecated',
> 
> It would be nice if the list of possible values was generated
> automatically (maybe into a separate field from the regular help)

Yes.  I wasn't sure how to go about this.  All the help is already
provided by the switches:

  --format=ARG          Specify a format for this branch. Current
formats are:                        default, knit, metaweave and weave.
Default is knit;
                        metaweave and weave are deprecated
  --default             Format using knits.  Recommended.
  --experimental-knit2  Experimental successor to knit.  Use at your own
risk.  --knit                Format using knits.  Recommended.
  --metaweave           Transitional format in 0.8.  Slower than knit.
  --weave               Pre-0.8 format.  Slower than knit and does not
support                        checkouts or shared repositories.

So if we show that, we could potentially be repeating a lot of text.  We
also have the "bzr help formats" display, which displays the same
information, somewhat differently.

Here are some possible approaches:
- - Show possible values all the time
- - Only show possible values when value_switches is false
- - Provide "see also: bzr help formats"

Do any of these sound good?  Do you have another idea?

> + +class BadOptionParam(BzrError):
> + + _fmt = """Bad parameter "%(value)s" for option "%(name)s"."""
> + + def __init__(self, name, value):
> + BzrError.__init__(self, name=name, value=value)
> 
> I'd suggest not abbreviating in class names because there can be
> inconsistency if other people use the full name.

Fair enough.  I'll try to avoid that.

> Anyhow I think the correct name for the bit after the = is "option
> value", at least in optparse.

Okay.

> +    """Option based on a registry"""
> 
> Could do with a little more text:
> 
>   The values for the options correspond to entries in the registry...

Okay.

I've attatched an update, but it doesn't address the help issue.

I expect this will go into bzr.dev when 0.15 opens up.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFFo7K/0F+nu1YWqI0RAoSIAKCH7TkeNIW+fSi7d2NwTvpPUBCFDQCfdwGI
l8MvBO/jx+VMl185ZBgvK9U=
=GV+P
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: registryoption2.patch
Type: text/x-patch
Size: 44187 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20070109/c3676baa/attachment-0001.bin 


More information about the bazaar mailing list