9ece2ec5a3cf0c2040ee670175cd687fe3969101
1 # GNU MediaGoblin -- federated, autonomous media hosting
2 # Copyright (C) 2011 Free Software Foundation, Inc
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU Affero General Public License as published by
6 # the Free Software Foundation, either version 3 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 Affero General Public License for more details.
14 # You should have received a copy of the GNU Affero General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 from mediagoblin
import util
as mg_util
24 'setup': 'mediagoblin.gmg_commands.shell:shell_parser_setup',
25 'func': 'mediagoblin.gmg_commands.shell:shell',
26 'help': 'Run a shell with some tools pre-setup'},
31 parser
= argparse
.ArgumentParser(
32 description
='GNU MediaGoblin utilities.')
34 subparsers
= parser
.add_subparsers(help='sub-command help')
35 for command_name
, command_struct
in SUBCOMMAND_MAP
.iteritems():
36 if command_struct
.has_key('help'):
37 subparser
= subparsers
.add_parser(
38 command_name
, help=command_struct
['help'])
40 subparser
= subparsers
.add_parser(command_name
)
42 setup_func
= mg_util
.import_component(command_struct
['setup'])
43 exec_func
= mg_util
.import_component(command_struct
['func'])
47 subparser
.set_defaults(func
=exec_func
)
49 args
= parser
.parse_args()
53 if __name__
== '__main__':