/usr/share/pyshared/paste/script/help.py is in python-pastescript 1.7.5-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org)
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
from command import Command, get_commands
from command import parser as base_parser
class HelpCommand(Command):
summary = "Display help"
usage = '[COMMAND]'
max_args = 1
parser = Command.standard_parser()
def command(self):
if not self.args:
self.generic_help()
return
name = self.args[0]
commands = get_commands()
if name not in commands:
print 'No such command: %s' % name
self.generic_help()
return
command = commands[name].load()
runner = command(name)
runner.run(['-h'])
def generic_help(self):
base_parser.print_help()
print
commands_grouped = {}
commands = get_commands()
longest = max([len(n) for n in commands.keys()])
for name, command in commands.items():
try:
command = command.load()
except Exception, e:
print 'Cannot load command %s: %s' % (name, e)
continue
if getattr(command, 'hidden', False):
continue
commands_grouped.setdefault(
command.group_name, []).append((name, command))
commands_grouped = commands_grouped.items()
commands_grouped.sort()
print 'Commands:'
for group, commands in commands_grouped:
if group:
print group + ':'
commands.sort()
for name, command in commands:
print ' %s %s' % (self.pad(name, length=longest),
command.summary)
#if command.description:
# print self.indent_block(command.description, 4)
print
|