FEATURE REQ: Make alias for --diff-options
Jari Aalto
jari.aalto at cante.net
Tue Sep 13 17:28:41 BST 2005
John A Meinel <john at arbash-meinel.com> writes:
| > $ bzr diff --diff-options -bwc -C 5
| >
|
| As I may have mentioned. One problem is that the short options are
| consistent across all commands. So while "-o" makes the most sense to
| diff as "--diff-options", it might make more sense as "--output" for
| something else. As the interface settles down, I think we'll see more
| short options form.
|
| In the mean-time, might I recommend this plugin:
|
| import bzrlib, bzrlib.builtins
|
| class cmd_mydiff(bzrlib.builtins.cmd_diff):
| def run(self, *args, **kwargs):
| kwargs['diff_options'] = '-bwu -C 5'
| super(cmd_mydiff, self).run(*args, **kwargs)
|
| bzrlib.commands.register_command(cmd_mydiff)
|
| Save the above snippet to ~/.bzr.conf/plugins/somefile.py
|
| And then it should be automatically loaded by bzr and allow you to type:
|
| bzr mydiff
|
| Which should set up all the options that you care about. If you *always*
| want to use it, you can even name the function "cmd_diff", the namespace
| prevents it from being confused, and then just a plain "bzr diff" will
| run with your custom options. (If you do overload "bzr diff", then you
| can run "bzr --no-plugins diff", or "bzr --builtins diff" to get the
| original function).
Impressive. I have to digest this for few more moon rounds since I
know nothing about Python.
Jari
More information about the bazaar
mailing list