root/galaxy-central/eggs/PasteScript-1.7.3-py2.6.egg/paste/script/help.py @ 3

リビジョン 3, 1.9 KB (コミッタ: kohda, 14 年 前)

Install Unix tools  http://hannonlab.cshl.edu/galaxy_unix_tools/galaxy.html

行番号 
1# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org)
2# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
3from command import Command, get_commands
4from command import parser as base_parser
5
6class HelpCommand(Command):
7
8    summary = "Display help"
9    usage = '[COMMAND]'
10
11    max_args = 1
12
13    parser = Command.standard_parser()
14
15    def command(self):
16        if not self.args:
17            self.generic_help()
18            return
19
20        name = self.args[0]
21        commands = get_commands()
22        if name not in commands:
23            print 'No such command: %s' % name
24            self.generic_help()
25            return
26
27        command = commands[name].load()
28        runner = command(name)
29        runner.run(['-h'])
30       
31    def generic_help(self):
32        base_parser.print_help()
33        print
34        commands_grouped = {}
35        commands = get_commands()
36        longest = max([len(n) for n in commands.keys()])
37        for name, command in commands.items():
38            try:
39                command = command.load()
40            except Exception, e:
41                print 'Cannot load command %s: %s' % (name, e)
42                continue
43            if getattr(command, 'hidden', False):
44                continue
45            commands_grouped.setdefault(
46                command.group_name, []).append((name, command))
47        commands_grouped = commands_grouped.items()
48        commands_grouped.sort()
49        print 'Commands:'
50        for group, commands in commands_grouped:
51            if group:
52                print group + ':'
53            commands.sort()
54            for name, command in commands:
55                print '  %s  %s' % (self.pad(name, length=longest),
56                                    command.summary)
57                #if command.description:
58                #    print self.indent_block(command.description, 4)
59            print
60       
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。