Skip to content

Commit

Permalink
Land #18973, improves the help menu for sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
adfoster-r7 authored Mar 20, 2024
2 parents 298e03b + 2c9ade9 commit fd83543
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
23 changes: 17 additions & 6 deletions lib/rex/post/sql/ui/console/command_dispatcher/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,22 +134,33 @@ def run_query(query)
end

def cmd_query(*args)
@@query_opts.parse(args) do |opt, idx, val|
show_help = false
call_interactive = false

@@query_opts.parse(args) do |opt, _idx, val|
case opt
when nil
show_help = true if val == 'help'
break
when '-h', '--help'
cmd_query_help
return
show_help = true
break
when '-i', '--interact'
cmd_query_interactive
return
call_interactive = true
break
end
end

if args.empty?
if args.empty? || show_help
cmd_query_help
return
end

if call_interactive
cmd_query_interactive
return
end

result = run_query(args.join(' '))
case result[:status]
when :success
Expand Down
2 changes: 1 addition & 1 deletion lib/rex/ui/text/dispatcher_shell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ def help_to_s(opts = {})
str << dispatcher.help_to_s(opts.merge({ command_width: [max_command_length, 12].max }))
}

return str
return str << "For more info on a specific command, use %grn<command> -h%clr or %grnhelp <command>%clr.\n\n"
end


Expand Down

0 comments on commit fd83543

Please sign in to comment.