summaryrefslogtreecommitdiff
path: root/obnam
diff options
context:
space:
mode:
authorLars Wirzenius <liw@gytha>2008-03-23 13:28:17 +0200
committerLars Wirzenius <liw@gytha>2008-03-23 13:28:17 +0200
commit587cc36ad26250729e76a6eea6ea7d9a1bbfb2c2 (patch)
tree086c735c46d6785f2720bf55f23bfd94974541e2 /obnam
parent24953bb26736e69489aa232960d652e701d88d62 (diff)
downloadobnam-587cc36ad26250729e76a6eea6ea7d9a1bbfb2c2.tar.gz
Added some documentation, and a do_it method.
Diffstat (limited to 'obnam')
-rw-r--r--obnam/oper.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/obnam/oper.py b/obnam/oper.py
index e664c619..c157549a 100644
--- a/obnam/oper.py
+++ b/obnam/oper.py
@@ -18,8 +18,24 @@
"""Obnam operations."""
+import obnam
+
+
class Operation:
+ """A user-visible operation for the Obnam backup program.
+
+ User-visible operations are things like "make a backup", "restore
+ files from a backup", "list backup generations", and so on. This
+ base class abstracts the operations so that they can be easily
+ implemented. Associated with this is the OperationFactory class,
+ which will automatically instantiate the right Operation subclass
+ based on command line arguments. For this to work, subclasses
+ MUST set the 'name' attribute to the command word the user will
+ use on the command line.
+
+ """
+
name = None
def __init__(self, app, args):
@@ -33,3 +49,15 @@ class Operation:
def get_args(self):
"""Return arguments this operation instance will use."""
return self._args
+
+ def do_it(self, args):
+ """Do the operation.
+
+ 'args' will contain all command line arguments /except/ the
+ command word. There's no point in passing that to this class,
+ since we already know it must be our name.
+
+ Subclasses should override this method with something that
+ is actually useful. The default implementation does nothing.
+
+ """