allow commands that are .pyc files to be used

This commit is contained in:
Damien Churchill 2009-11-04 23:49:07 +00:00
parent 902ef3fa28
commit fa5b7e7a66
1 changed files with 5 additions and 3 deletions

View File

@ -124,10 +124,12 @@ def load_commands(command_dir, exclude=[]):
try:
commands = []
for filename in os.listdir(command_dir):
if filename.split('.')[0] in exclude or filename.startswith('_') or not filename.endswith('.py'):
if filename.split('.')[0] in exclude or filename.startswith('_'):
continue
cmd = get_command(filename[:-3])
aliases = [ filename[:-3] ]
if not (filename.endswith('.py') or filename.endswith('.pyc')):
continue
cmd = get_command(filename.split('.')[len(filename.split('.')) - 2])
aliases = [ filename.split('.')[len(filename.split('.')) - 2] ]
aliases.extend(cmd.aliases)
for a in aliases:
commands.append((a, cmd))