Aliases and lazy commands and DRY

Martin Pool mbp at canonical.com
Tue Feb 9 01:12:58 GMT 2010


On 9 February 2010 00:55, Alexander Belchenko <bialix at ukr.net> wrote:
> There is one DRY violation case in the bzr support of lazy commands
> registration.
>
> From plugin I can lazily register the command and also I can provide the
> aliases for such command. And it will work for real command execution, but
> these aliases won't be shown in the help for the command itself. Unless I
> will add them manually to command class as aliases list.
>
> This is not critical problem of course, but it's slightly inconvenient,
> especially if plugin author is not aware of this problem.
>
> Maybe if help generator will check lazy aliases with actual aliases and
> override the latter or maybe emit the warning, maybe it will help. But I
>  can suspect that lazy aliases info is not available in easy way for help
> generator code and therefore fixing this maybe too high price for such small
> thing.
>
> I'm not sure is it worth to filing a bug, just hope to hear some comments
> from smart people.

I was having a look yesterday at changing the builtin commands to be
lazily loaded, mostly for the sake of improving startup speed.  I
agree that the aliases should be defined only once, and this has to be
done when the command is registered so that they can be looked up
without loading every command.  We should change the code so that if
you later want to know all the aliases of a command (eg for help) it
looks at the same data.

-- 
Martin <http://launchpad.net/~mbp/>



More information about the bazaar mailing list