Sha256: 0d7fd1b718335cde1616d8e35bd380b3c0c424b05390dc4811fbaf8df9200f7e

Contents?: true

Size: 1.02 KB

Versions: 3

Compression:

Stored size: 1.02 KB

Contents

#!/usr/bin/env ruby

require 'optparse'
require 'maril'

options = {}
optparser = OptionParser.new do |opts|
  opts.banner = "Usage: maril --host your.marathon.host --id /your/marathon/app/id"

  opts.on("-h", "--host HOST", "Marathon Host") do |host|
    options[:host] = host
  end

  opts.on("-i", "--id ID", "Marathon Application ID") do |id|
    options[:id] = id
  end

  opts.on("-d", "--debug", "Debug Mode. If something wrong, it will print raw error out.") do |debug|
    options[:debug] = debug
  end
end
optparser.parse!
if options[:host].nil? || options[:id].nil?
  puts optparser.help
  exit
end

begin
  generator = Maril::Generator.new(host: options[:host], id: options[:id])
  puts generator.generate
rescue => e
  if options[:debug]
    puts "PARAMETERS:\n" \
         "  #{options.inspect}\n\n" \
         "ERROR MESSAGE:\n" \
         "  #{e.message}\n\n" \
         "BACKTRACE:\n" \
         "  #{e.backtrace.join("\n  ")}"
  else
    puts "There is something wrong. Please use debug mode to see more details."
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
maril-0.1.2 exe/maril
maril-0.1.1 exe/maril
maril-0.1.0 exe/maril