@@ -44,6 +44,26 @@ def get_actions(instance):
4444 def get_groups (parser ):
4545 return getattr (parser , "option_groups" , None ) or getattr (parser , "_action_groups" )
4646
47+ def get_all_options (parser ):
48+ retVal = set ()
49+
50+ for option in get_actions (parser ):
51+ if hasattr (option , "option_strings" ):
52+ retVal .update (option .option_strings )
53+ else :
54+ retVal .update (option ._long_opts )
55+ retVal .update (option ._short_opts )
56+
57+ for group in get_groups (parser ):
58+ for option in get_actions (group ):
59+ if hasattr (option , "option_strings" ):
60+ retVal .update (option .option_strings )
61+ else :
62+ retVal .update (option ._long_opts )
63+ retVal .update (option ._short_opts )
64+
65+ return retVal
66+
4767from lib .core .common import checkOldOptions
4868from lib .core .common import checkSystemEncoding
4969from lib .core .common import dataToStdout
@@ -844,18 +864,10 @@ def _format_action_invocation(self, action):
844864 parser .usage = ""
845865 cmdLineOptions .sqlmapShell = True
846866
847- _ = ["x" , "q" , "exit" , "quit" , "clear" ]
848-
849- for option in get_actions (parser ):
850- _ .extend (option ._long_opts )
851- _ .extend (option ._short_opts )
852-
853- for group in get_groups (parser ):
854- for option in get_actions (group ):
855- _ .extend (option ._long_opts )
856- _ .extend (option ._short_opts )
867+ commands = set (("x" , "q" , "exit" , "quit" , "clear" ))
868+ commands .update (get_all_options (parser ))
857869
858- autoCompletion (AUTOCOMPLETE_TYPE .SQLMAP , commands = _ )
870+ autoCompletion (AUTOCOMPLETE_TYPE .SQLMAP , commands = commands )
859871
860872 while True :
861873 command = None
0 commit comments