Bug 846409 - Add |mach mach-debug-commands|; r=jhammel

DONTBUILD (NPOTB)
This commit is contained in:
Gregory Szorc 2013-03-04 10:18:48 -08:00
parent 9376d7ad68
commit eeedb5018f
2 changed files with 36 additions and 0 deletions

View File

@ -31,6 +31,7 @@ SEARCH_PATHS = [
MACH_MODULES = [
'addon-sdk/mach_commands.py',
'layout/tools/reftest/mach_commands.py',
'python/mach/mach/commands/commandinfo.py',
'python/mozboot/mozboot/mach_commands.py',
'python/mozbuild/mozbuild/config.py',
'python/mozbuild/mozbuild/mach_commands.py',

View File

@ -0,0 +1,35 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, # You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import print_function, unicode_literals
from mach.decorators import (
CommandProvider,
Command,
)
@CommandProvider
class BuiltinCommands(object):
def __init__(self, context):
self.context = context
@Command('mach-debug-commands', help='Show info about available mach commands.')
def commands(self):
import inspect
handlers = self.context.commands.command_handlers
for command in sorted(handlers.keys()):
handler = handlers[command]
cls = handler.cls
method = getattr(cls, getattr(handler, 'method'))
print(command)
print('=' * len(command))
print('')
print('File: %s' % inspect.getsourcefile(method))
print('Class: %s' % cls.__name__)
print('Method: %s' % handler.method)
print('')