CHANGES: mention the documentation improvements and typofixes
[git-cola.git] / cola / cmd.py
blobbf318b98d51a6bdf1ac27aa047c41b050cf6cf32
1 """Base Command class"""
2 from __future__ import absolute_import, division, print_function, unicode_literals
5 class Command(object):
6 """Mixin interface for commands"""
8 UNDOABLE = False
10 @staticmethod
11 def name():
12 """Return the command's name"""
13 return '(undefined)'
15 @classmethod
16 def is_undoable(cls):
17 """Can this be undone?"""
18 return cls.UNDOABLE
20 # pylint: disable=no-self-use
21 def do(self):
22 """Execute the command"""
23 return
25 # pylint: disable=no-self-use
26 def undo(self):
27 """Undo the command"""
28 return
31 class ContextCommand(Command):
32 """Base class for commands that operate on a context"""
34 def __init__(self, context):
35 self.context = context
36 self.model = context.model
37 self.cfg = context.cfg
38 self.git = context.git
39 self.selection = context.selection
40 self.fsmonitor = context.fsmonitor