Class: Lhj::Command::OSS::Del
- Inherits:
-
Lhj::Command::OSS
- Object
- CLAide::Command
- Lhj::Command
- Lhj::Command::OSS
- Lhj::Command::OSS::Del
- Defined in:
- lib/lhj/command/oss/del.rb
Instance Method Summary collapse
- #handle ⇒ Object
-
#initialize(argv) ⇒ Del
constructor
A new instance of Del.
Methods inherited from Lhj::Command
#auto_spin, #begin_title, #run, #stop
Constructor Details
#initialize(argv) ⇒ Del
10 11 12 13 |
# File 'lib/lhj/command/oss/del.rb', line 10 def initialize(argv) @cli = HighLine.new super end |
Instance Method Details
#handle ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/lhj/command/oss/del.rb', line 15 def handle objects = Lhj::OSS::Helper.instance.list obj_keys = [] objects.each_with_index do |o, i| obj_keys << o.key puts "#{i}.#{o.key}".yellow end idx = @cli.ask('请选择删除的key: '.green).strip.to_i oss_key = obj_keys[idx] puts "删除的key为:#{oss_key}".red Lhj::OSS::Helper.instance.delete(oss_key) end |