Skip to content

Commit

Permalink
Merge pull request #154 from facebook/command-help
Browse files Browse the repository at this point in the history
Provide a help string when registering commands
  • Loading branch information
kastiglione committed May 6, 2016
2 parents da3d84c + e959857 commit de22648
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion fblldb.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def loadCommandsInDirectory(commandsDirectory):
def loadCommand(module, command, directory, filename, extension):
func = makeRunCommand(command, os.path.join(directory, filename + extension))
name = command.name()
helpText = command.description().splitlines()[0] # first line of description

key = filename + '_' + name

Expand All @@ -49,7 +50,10 @@ def loadCommand(module, command, directory, filename, extension):
functionName = '__' + key

lldb.debugger.HandleCommand('script ' + functionName + ' = sys.modules[\'' + module.__name__ + '\']._loadedFunctions[\'' + key + '\']')
lldb.debugger.HandleCommand('command script add -f ' + functionName + ' ' + name)
lldb.debugger.HandleCommand('command script add --help "{help}" --function {function} {name}'.format(
help=helpText.replace('"', '\\"'), # escape quotes
function=functionName,
name=name))

def makeRunCommand(command, filename):
def runCommand(debugger, input, result, dict):
Expand Down

0 comments on commit de22648

Please sign in to comment.