doc: remove empty line
[git-cola.git] / cola / cmd.py
blob1c2f93e78f2ac4d0e7871315086bed4c5843f922
1 """Base Command class"""
2 from __future__ import division, absolute_import, unicode_literals
5 class Command(object):
6 """Mixin interface for commands"""
7 UNDOABLE = False
9 @staticmethod
10 def name():
11 """Return the command's name"""
12 return '(undefined)'
14 @classmethod
15 def is_undoable(cls):
16 """Can this be undone?"""
17 return cls.UNDOABLE
19 # pylint: disable=no-self-use
20 def do(self):
21 """Execute the command"""
22 return
24 # pylint: disable=no-self-use
25 def undo(self):
26 """Undo the command"""
27 return
30 class ContextCommand(Command):
31 """Base class for commands that operate on a context"""
33 def __init__(self, context):
34 self.context = context
35 self.model = context.model
36 self.cfg = context.cfg
37 self.git = context.git
38 self.selection = context.selection
39 self.fsmonitor = context.fsmonitor