File tree Expand file tree Collapse file tree 1 file changed +27
-10
lines changed
lib/msf/ui/console/command_dispatcher Expand file tree Collapse file tree 1 file changed +27
-10
lines changed Original file line number Diff line number Diff line change @@ -153,22 +153,39 @@ def cmd_generate(*args)
153
153
end
154
154
155
155
def cmd_generate_tabs ( str , words )
156
+ fmt = {
157
+ '-b' => [ true ] ,
158
+ '-E' => [ nil , ] ,
159
+ '-e' => [ framework . encoders . map { |refname , mod | refname } ] ,
160
+ '-h' => [ nil , ] ,
161
+ '-o' => [ true , ] ,
162
+ '-s' => [ true , ] ,
163
+ '-f' => [ :file , ] ,
164
+ '-t' => [ @@supported_formats , ] ,
165
+ '-p' => [ true , ] ,
166
+ '-k' => [ nil , ] ,
167
+ '-x' => [ :file , ] ,
168
+ '-i' => [ true , ]
169
+ }
170
+ tab_complete_spec ( fmt , str , words )
171
+ end
172
+
173
+ def tab_complete_spec ( fmt , str , words )
156
174
last_word = words [ -1 ]
157
- fmt = @@generate_opts . fmt
158
175
fmt = fmt . select { |key , value | last_word == key || !words . include? ( key ) }
159
176
160
- option = fmt [ last_word ]
161
- return fmt . keys if !option || !option [ 0 ]
177
+ val = fmt [ last_word ]
178
+ return fmt . keys if !val # the last word does not look like a fmtspec
179
+ arg = val [ 0 ]
180
+ return fmt . keys if !arg # the last word is a fmtspec that takes no argument
162
181
163
182
tabs = [ ]
164
- case last_word
165
- when '-e'
166
- tabs = framework . encoders . map { |refname , mod | refname }
167
- when '-f'
168
- tabs = tab_complete_filenames ( str , words )
169
- when '-t'
170
- tabs = @@supported_formats
183
+ if arg . to_s . to_sym == :file
184
+ tabs = tab_complete_filenames ( str , words )
185
+ elsif arg . kind_of? ( Array )
186
+ tabs = arg . map { |a | a . to_s }
171
187
end
188
+ tabs
172
189
end
173
190
end
174
191
end
You can’t perform that action at this time.
0 commit comments