Class: Hako::CLI::ShowYaml

Inherits:
Object
  • Object
show all
Defined in:
lib/hako/cli.rb

Instance Method Summary collapse

Instance Method Details

#parse!(argv) ⇒ Object



189
190
191
192
193
194
195
196
# File 'lib/hako/cli.rb', line 189

def parse!(argv)
  parser.parse!(argv)
  @yaml_path = argv.first
  if @yaml_path.nil?
    puts parser.help
    exit 1
  end
end

#parserObject



198
199
200
201
202
203
# File 'lib/hako/cli.rb', line 198

def parser
  @parser ||= OptionParser.new do |opts|
    opts.banner = 'hako show-yaml FILE'
    opts.version = VERSION
  end
end

#run(argv) ⇒ Object



183
184
185
186
187
# File 'lib/hako/cli.rb', line 183

def run(argv)
  parse!(argv)
  require 'hako/yaml_loader'
  puts YamlLoader.new.load(Pathname.new(@yaml_path)).to_yaml
end