5e787847a586d5935553a23c20f110a9ea2ab579
[hooke.git] / hooke / plugin / license.py
1 # Copyright (C) 2010-2012 W. Trevor King <wking@drexel.edu>
2 #
3 # This file is part of Hooke.
4 #
5 # Hooke is free software: you can redistribute it and/or modify it under the
6 # terms of the GNU Lesser General Public License as published by the Free
7 # Software Foundation, either version 3 of the License, or (at your option) any
8 # later version.
9 #
10 # Hooke is distributed in the hope that it will be useful, but WITHOUT ANY
11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12 # A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
13 # details.
14 #
15 # You should have received a copy of the GNU Lesser General Public License
16 # along with Hooke.  If not, see <http://www.gnu.org/licenses/>.
17
18 """The ``license`` module provides :class:`LicensePlugin` and
19 associated :class:`hooke.command.Command`\s for displaying Hooke's
20 licensing information.
21 """
22
23 from .. import __license__
24 from ..command import Command, Argument, Failure
25 from . import Builtin
26
27
28 class LicensePlugin (Builtin):
29     def __init__(self):
30         super(LicensePlugin, self).__init__(name='license')
31         self._commands = [LicenseCommand(self)]
32
33
34 # Define commands
35
36 class LicenseCommand (Command):
37     """Show licensing information.
38     """
39     def __init__(self, plugin):
40         super(LicenseCommand, self).__init__(
41             name='license',
42             help=self.__doc__, plugin=plugin)
43
44     def _run(self, hooke, inqueue, outqueue, params):
45         outqueue.put(__license__)