Skip to content

Commit 94cb5b5

Browse files
authored
Add a way to provide a complete method to a gdb.Command
2 parents 80835e2 + 1669818 commit 94cb5b5

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

.gdbinit

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -674,8 +674,19 @@ class Dashboard(gdb.Command):
674674

675675
@staticmethod
676676
def create_command(name, invoke, doc, is_prefix, complete=None):
677-
Class = type('', (gdb.Command,), {'invoke': invoke, '__doc__': doc})
678-
Class(name, gdb.COMMAND_USER, complete or gdb.COMPLETE_NONE, is_prefix)
677+
if callable(complete):
678+
Class = type('', (gdb.Command,), {
679+
'__doc__': doc
680+
'invoke': invoke,
681+
'complete': complete
682+
})
683+
Class(name, gdb.COMMAND_USER, prefix=is_prefix)
684+
else:
685+
Class = type('', (gdb.Command,), {
686+
'__doc__': doc,
687+
'invoke': invoke
688+
})
689+
Class(name, gdb.COMMAND_USER, complete or gdb.COMPLETE_NONE, is_prefix)
679690

680691
@staticmethod
681692
def err(string):

0 commit comments

Comments
 (0)