Use OptionParser

GSoC/Meterpreter_Web_Console
Erin Bleiweiss 2018-09-26 18:08:46 -05:00
parent f8984c4f9b
commit 71cb3e8e94
No known key found for this signature in database
GPG Key ID: F69B2138BD594660
1 changed files with 18 additions and 13 deletions

View File

@ -204,27 +204,32 @@ class Msf::Ui::Console::CommandDispatcher::Developer
end
def cmd_reload_lib_help
print_line 'Usage: reload_lib lib/to/reload.rb [...]'
print_line
print_line 'Reload one or more library files from specified paths.'
print_line
print_line 'OPTIONS:'
print_line ' -a, --all Reload all changed files in your current git working tree.'
cmd_reload_lib '-h'
end
#
# Reload one or more library files from specified paths
#
def cmd_reload_lib(*args)
if args.empty? || args.include?('-h') || args.include?('--help')
cmd_reload_lib_help
return
elsif args.include?('-a') || args.include?('--all')
reload_diff_files
return
opts = OptionParser.new do |opts|
opts.banner = 'Usage: reload_lib lib/to/reload.rb [...]'
opts.separator 'Reload one or more library files from specified paths.'
opts.separator ''
opts.on '-h', '--help', 'Help banner.' do
return print(opts.help)
end
opts.on '-a', '--all', 'Reload all changed files in your current git working tree.' do
reload_diff_files
return
end
end
args.each { |path| reload_file(path) }
rest = opts.order(args)
rest.each { |path| reload_file(path) }
end
#