@@ -4768,29 +4768,55 @@ def __set_repeat_count(self, argv: List[str], from_tty: bool) -> None:
4768
4768
4769
4769
4770
4770
@register
4771
- class ArchCommand (GenericCommand ):
4771
+ class PieCommand (GenericCommand ):
4772
4772
"""Manage the current loaded architecture"""
4773
4773
4774
4774
_cmdline_ = "arch"
4775
4775
_syntax_ = f"{ _cmdline_ } (list|get|set) ..."
4776
4776
_example_ = f"{ _cmdline_ } "
4777
4777
4778
+ def __init__ (self ) -> None :
4779
+ super ().__init__ (prefix = True )
4780
+ return
4781
+
4782
+ def do_invoke (self , argv : List [str ]) -> None :
4783
+ if not argv :
4784
+ self .usage ()
4785
+ return
4786
+
4787
+ @register
4788
+ class ArchGetCommand (GenericCommand ):
4789
+ """Get the current loaded architecture"""
4790
+
4791
+ _cmdline_ = "arch get"
4792
+ _syntax_ = f"{ _cmdline_ } "
4793
+ _example_ = f"{ _cmdline_ } "
4794
+
4778
4795
def do_invoke (self , args : List [str ]) -> None :
4779
- if len (args ) == 0 or args [0 ] == 'get' :
4780
- self ._get_cmd ()
4781
- elif args [0 ] == 'set' :
4782
- self ._set_cmd (* args [1 :])
4783
- elif args [0 ] == 'list' :
4784
- self ._list_cmd ()
4796
+ gef_print (f"{ Color .greenify ('Arch' )} : { gef .arch } " )
4797
+ gef_print (f"{ Color .greenify ('Reason' )} : { gef .arch_reason } " )
4785
4798
4786
- def _get_cmd (self ) -> None :
4787
- gef_print (f"{ Color .greenify ("Arch" )} : { gef .arch } " )
4788
- gef_print (f"{ Color .greenify ("Reason" )} : { gef .arch_reason } " )
4789
4799
4790
- def _set_cmd (self , arch = None , * args ) -> None :
4791
- reset_architecture (arch )
4800
+ @register
4801
+ class ArchSetCommand (GenericCommand ):
4802
+ """Set the current loaded architecture"""
4803
+
4804
+ _cmdline_ = "arch set"
4805
+ _syntax_ = f"{ _cmdline_ } <arch>"
4806
+ _example_ = f"{ _cmdline_ } "
4807
+
4808
+ def do_invoke (self , args : List [str ]) -> None :
4809
+ reset_architecture (args [0 ] if args else None )
4792
4810
4793
- def _list_cmd (self ) -> None :
4811
+ @register
4812
+ class ArchListCommand (GenericCommand ):
4813
+ """List the available architectures"""
4814
+
4815
+ _cmdline_ = "arch list"
4816
+ _syntax_ = f"{ _cmdline_ } "
4817
+ _example_ = f"{ _cmdline_ } "
4818
+
4819
+ def do_invoke (self , args : List [str ]) -> None :
4794
4820
gef_print (Color .greenify ("Available architectures:" ))
4795
4821
for arch in __registered_architectures__ .keys ():
4796
4822
if type (arch ) == str :
0 commit comments