RFC: command composition
Robert Collins
robertc at robertcollins.net
Mon Feb 9 09:20:58 GMT 2009
On Mon, 2009-02-09 at 08:17 +0100, Vincent Ladeuil wrote:
> >>>>> "robert" == Robert Collins <robertc at robertcollins.net> writes:
>
> robert> This is a bit rambly, but I need to get it out of my
> robert> buffers :P. I'd like to be able to modify the input
> robert> to commands from a plugin, without fully decorating
> robert> the command. Fully decorating is complex because you
> robert> have to keep up with option changes and so on; if I
> robert> could add an option (or options), and when they are
> robert> given be called with the option and arguments (dict,
> robert> list) tuple, then return that to the next handler, I
> robert> could modify the input access to the parsed options
> robert> for a command without having to adjust the plugin
> robert> simply because a new unrelated option was added.
>
> +1 on the idea.
>
> I think it could be achieved by just telling the parser to call a
> method with unparsed arguments *before* erroring on them.
Well the plugin's option should be in the options list. So I'm thinking
a method on command class to register the callback and add options; with
a list in the cmd_FOO instance that provides the callback to call. Then
the callback occurs on the parsed (options, args) tuple as I mentioned
above.
-Rob
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20090209/1bff7369/attachment.pgp
More information about the bazaar
mailing list