Sha256: cf530ddda4efa9fd61d5256b1a81ff31b7542cfc4e47b20a9a4a24bcfe17060e
Contents?: true
Size: 767 Bytes
Versions: 1
Compression:
Stored size: 767 Bytes
Contents
require 'logger' module Reveal module Cli extend self def process(args) command_name = args.first.gsub('-', '_') command_args = args[1..-1] cmd = Reveal::Command.new(logger) supported_cmds = cmd.methods - cmd.class.methods unless supported_cmds.include?(command_name) puts "Command '#{command_name}' not supported.\nSupported commands: #{supported_cmds.join(", ")}" exit 1 end send(command_name, command_args) rescue Exception => e puts e.message exit 1 end private def logger @logger ||= begin logger = ::Logger.new(STDOUT) logger.formatter = proc do |_, _, _, msg| "#{msg}\n" end logger end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
reveal.rb-0.5.1 | lib/reveal/cli.rb |