Class: Lhj::Command::Config::Update
- Inherits:
-
Lhj::Command::Config
- Object
- CLAide::Command
- Lhj::Command
- Lhj::Command::Config
- Lhj::Command::Config::Update
- Defined in:
- lib/lhj/command/config/info.rb
Instance Method Summary collapse
Methods inherited from Lhj::Command::Config
#config_dir, #handle, #initialize, #print_table, #show_config
Methods inherited from Lhj::Command
#auto_spin, #begin_title, #handle, #initialize, #run, #stop
Constructor Details
This class inherits a constructor from Lhj::Command::Config
Instance Method Details
#ask_which_one ⇒ Object
74 75 76 |
# File 'lib/lhj/command/config/info.rb', line 74 def ask_which_one @cli.ask('更新哪个配置: '.green).strip.to_i end |
#handle_yaml(file) ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/lhj/command/config/info.rb', line 78 def handle_yaml(file) table_rows = [] content = YAML.load_file(file) if content.is_a?(Hash) content.each do |key, value| table_rows << [key, value] end end title = File.basename(file).to_s print_table(title, table_rows) if table_rows.count.positive? cmd = ['open'] cmd << file Actions.sh(cmd.join(' ')) end |