1
# Copyright (C) 2004 Aaron Bentley
2
# <aaron.bentley@utoronto.ca>
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; either version 2 of the License, or
7
# (at your option) any later version.
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
# GNU General Public License for more details.
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
#ensure that the parent directory is in the path (for epydoc)
22
sys.path=[os.path.realpath(os.path.dirname(__file__)+"/..")]+sys.path
26
__docformat__ = "restructuredtext"
27
__doc__ = "command template"
29
class Template(commands.BaseCommand):
30
"""Template for writing new commands"""
32
self.description = self.__doc__
34
# override get_completer if you want custom completion
35
# def get_completer(self, arg, index):
36
# return cmdutil.iter_dir_completions(arg)
38
def do_command(self, cmdargs):
39
parser=self.get_parser()
40
(options, args) = parser.parse_args(cmdargs)
47
parser = cmdutil.CmdOptionParser("example ARGUMENT1 ARGUMENT2")
50
def help(self, parser=None):
52
Prints a help message.
54
:param parser: If supplied, the parser to use for generating help. If \
55
not supplied, it is retrieved.
56
:type parser: cmdutil.CmdOptionParser
59
parser=self.get_parser()
62
Verbose help text goes here.
66
#This function assigns the command class to a user command name
67
def add_command(commands):
68
commands["template"] = Template
71
# arch-tag: 9feb1e39-86dd-447f-8999-5f8eab1f4ddf