Package caldavclientlibrary :: Package browser :: Module command
[hide private]
[frames] | no frames]

Source Code for Module caldavclientlibrary.browser.command

 1  ## 
 2  # Copyright (c) 2007-2016 Apple Inc. All rights reserved. 
 3  # 
 4  # Licensed under the Apache License, Version 2.0 (the "License"); 
 5  # you may not use this file except in compliance with the License. 
 6  # You may obtain a copy of the License at 
 7  # 
 8  # http://www.apache.org/licenses/LICENSE-2.0 
 9  # 
10  # Unless required by applicable law or agreed to in writing, software 
11  # distributed under the License is distributed on an "AS IS" BASIS, 
12  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
13  # See the License for the specific language governing permissions and 
14  # limitations under the License. 
15  ## 
16   
17 -class Command(object):
18
19 - def __init__(self):
20 21 self.shell = None 22 self.cmds = ()
23
24 - def execute(self, name, options):
25 raise NotImplementedError
26
27 - def usage(self, name):
28 raise NotImplementedError
29
30 - def hasHelp(self, name):
31 return name in self.cmds
32
33 - def help(self, name):
34 result = "Command: %s\n" % (name,) 35 result += "Description: %s\n" % (self.helpDescription(),) 36 result += self.usage(name) 37 return result
38
39 - def helpListing(self, name):
40 return (name, self.helpDescription())
41
42 - def helpDescription(self):
43 return ""
44
45 - def setShell(self, shell):
47
48 - def getCmds(self):
49 return self.cmds
50
51 - def complete(self, text):
52 return ()
53
54 -class WrongOptions(Exception):
55 pass
56
57 -class UnknownCommand(Exception):
58 pass
59
60 -class CommandError(Exception):
61 pass
62