Skip to content

Commit de22648

Browse files
committed
Merge pull request #154 from facebook/command-help
Provide a help string when registering commands
2 parents da3d84c + e959857 commit de22648

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

fblldb.py

100644100755
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ def loadCommandsInDirectory(commandsDirectory):
4141
def loadCommand(module, command, directory, filename, extension):
4242
func = makeRunCommand(command, os.path.join(directory, filename + extension))
4343
name = command.name()
44+
helpText = command.description().splitlines()[0] # first line of description
4445

4546
key = filename + '_' + name
4647

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

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

5458
def makeRunCommand(command, filename):
5559
def runCommand(debugger, input, result, dict):

0 commit comments

Comments
 (0)