make help show up when things are not specified correctly
parent
1029627a1f
commit
5899b8afc8
|
@ -156,24 +156,31 @@ class Console::CommandDispatcher::Android
|
||||||
end
|
end
|
||||||
|
|
||||||
def cmd_set_audio_mode(*args)
|
def cmd_set_audio_mode(*args)
|
||||||
|
help = false
|
||||||
mode = 1
|
mode = 1
|
||||||
set_audio_mode_opts = Rex::Parser::Arguments.new(
|
set_audio_mode_opts = Rex::Parser::Arguments.new(
|
||||||
'-h' => [ false, "Help Banner" ],
|
'-h' => [ false, "Help Banner" ],
|
||||||
'-m' => [ true, "Set Mode - (0 - OFF, 1 - Normal, 2 - Max) (Default: '#{mode}')"]
|
'-m' => [ true, "Set Mode - (0 - Off, 1 - Normal, 2 - Max) (Default: '#{mode}')"]
|
||||||
)
|
)
|
||||||
|
|
||||||
set_audio_mode_opts.parse(args) do |opt, _idx, val|
|
set_audio_mode_opts.parse(args) do |opt, _idx, val|
|
||||||
case opt
|
case opt
|
||||||
when '-h'
|
when '-h'
|
||||||
print_line('Usage: set_audio_mode [options]')
|
help = true
|
||||||
print_line('Set Ringer mode.')
|
|
||||||
print_line(set_audio_mode_opts.usage)
|
|
||||||
return
|
|
||||||
when '-m'
|
when '-m'
|
||||||
mode = val.to_i
|
mode = val.to_i
|
||||||
|
else
|
||||||
|
help = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if help || mode < 0 || mode > 2
|
||||||
|
print_line('Usage: set_audio_mode [options]')
|
||||||
|
print_line('Set Ringer mode.')
|
||||||
|
print_line(set_audio_mode_opts.usage)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
client.android.set_audio_mode(mode)
|
client.android.set_audio_mode(mode)
|
||||||
print_status("Ringer mode was changed to #{mode}!")
|
print_status("Ringer mode was changed to #{mode}!")
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue