Skip to content

Commit

Permalink
Add completion
Browse files Browse the repository at this point in the history
  • Loading branch information
ValekoZ committed Jun 2, 2024
1 parent bc7e518 commit 92276b3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions gef.py
Original file line number Diff line number Diff line change
Expand Up @@ -4800,9 +4800,17 @@ class ArchSetCommand(GenericCommand):
_syntax_ = f"{_cmdline_} <arch>"
_example_ = f"{_cmdline_} X86"

def __init__(self):
super().__init__(complete=-1) # -1 is the default for gdb but not for gef.
# It means we use the complete method for autocompletion.

def do_invoke(self, args: List[str]) -> None:
reset_architecture(args[0] if args else None)

def complete(self, text: str, word: str) -> List[str]:
return sorted(x for x in __registered_architectures__.keys() if
isinstance(x, str) and x.startswith(text.strip()))

@register
class ArchListCommand(GenericCommand):
"""List the available architectures."""
Expand Down

0 comments on commit 92276b3

Please sign in to comment.