49
from bzrlib.hooks import HookPoint, Hooks
46
from bzrlib.hooks import Hooks
50
47
# Compatibility - Option used to be in commands.
51
48
from bzrlib.option import Option
52
49
from bzrlib.plugin import disable_plugins, load_plugins
788
785
These are all empty initially, because by default nothing should get
792
self.create_hook(HookPoint('extend_command',
788
Hooks.__init__(self, "bzrlib.commands", "Command.hooks")
789
self.add_hook('extend_command',
793
790
"Called after creating a command object to allow modifications "
794
791
"such as adding or removing options, docs etc. Called with the "
795
"new bzrlib.commands.Command object.", (1, 13), None))
796
self.create_hook(HookPoint('get_command',
792
"new bzrlib.commands.Command object.", (1, 13))
793
self.add_hook('get_command',
797
794
"Called when creating a single command. Called with "
798
795
"(cmd_or_None, command_name). get_command should either return "
799
796
"the cmd_or_None parameter, or a replacement Command object that "
800
797
"should be used for the command. Note that the Command.hooks "
801
798
"hooks are core infrastructure. Many users will prefer to use "
802
799
"bzrlib.commands.register_command or plugin_cmds.register_lazy.",
804
self.create_hook(HookPoint('get_missing_command',
801
self.add_hook('get_missing_command',
805
802
"Called when creating a single command if no command could be "
806
803
"found. Called with (command_name). get_missing_command should "
807
804
"either return None, or a Command object to be used for the "
808
"command.", (1, 17), None))
809
self.create_hook(HookPoint('list_commands',
806
self.add_hook('list_commands',
810
807
"Called when enumerating commands. Called with a set of "
811
808
"cmd_name strings for all the commands found so far. This set "
812
809
" is safe to mutate - e.g. to remove a command. "
813
810
"list_commands should return the updated set of command names.",
816
813
Command.hooks = CommandHooks()