Nothing used it meaningfully. Also, due to the way `init_prompt` was set
prior to b1401e2e4e, it would have been
very broken: the prompt_char would have been included in the line twice
and prompt substitutions like %T would have been cached. Even more,
trying to append the empty string to the prompt (removed in that commit)
caused us to add a number of workarounds removed in
1df442e0cf.
This was inadvertently done as part of the tab completion
initialization but is what we want. Also move the prompt formatting to
the prompt update and make the code more readable.
This is an experiment to see what it would take to convert *all* option
assignment, parsing, and validation to use Ruby's builtin optparse. Our
current situation in the command dispatchers is a mishmash of bespoke
and Rex code, both with odd behaviors. Modules use a more formalized
system, but it is also a bit janky and unlike most other tools a
pentester might use.
The first step is to refactor the console commands to use Ruby's builtin
option parsing to reduce code and increase homogeneity among the various
functions. Next we plan to explore what it would take to invoke modules
from within Metasploit this way (this would be Metasploit 5+ only).
Refactoring `grep` seems to have been a success. There is now less code;
the code that declares and handles the options are now in the same
place; long options are now supported; adjacent, argument-less short
opts now work as expected; patterns can now begin with a `-`; and option
arguments are now validated. Additionally, optparse's argument
coercion/validation code can be extended for custom types/validations to
support more specialized commands.