Skip to content

Commit bc691cb

Browse files
committed
Document the new tab completion functions
1 parent fb76355 commit bc691cb

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

lib/rex/ui/text/dispatcher_shell.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,18 @@ def tab_complete_filenames(str, words)
248248
matches
249249
end
250250

251+
#
252+
# Provide a generic tab completion function based on the specification
253+
# pass as fmt. The fmt argument in a hash where values are an array
254+
# defining how the command should be completed. The first element of the
255+
# array can be one of:
256+
# nil - This argument is a flag and takes no option.
257+
# true - This argument takes an option with no suggestions.
258+
# :address - This option is a source address.
259+
# :bool - This option is a boolean.
260+
# :file - This option is a file path.
261+
# Array - This option is an array of possible values.
262+
#
251263
def tab_complete_generic(fmt, str, words)
252264
last_word = words[-1]
253265
fmt = fmt.select { |key, value| last_word == key || !words.include?(key) }
@@ -270,6 +282,9 @@ def tab_complete_generic(fmt, str, words)
270282
tabs
271283
end
272284

285+
#
286+
# Return a list of possible source addresses for tab completion.
287+
#
273288
def tab_complete_source_address
274289
addresses = [Rex::Socket.source_address]
275290
# getifaddrs was introduced in 2.1.2

0 commit comments

Comments
 (0)