Sha256: 38ee6cae2160b892791136510f7ba182cbcee151dde82d3c5bac8cb3a549507e
Contents?: true
Size: 1.32 KB
Versions: 7
Compression:
Stored size: 1.32 KB
Contents
#!/usr/bin/env ruby $:.unshift File.join(File.dirname(__FILE__), '../lib') require 'logger' require 'optparse' require 'yq' $stdout.sync = $stderr.sync = true unless defined?(LOGGER) LOGGER = Logger.new($stderr) end LOGGER.level = Logger::INFO @options = { context: :main_loop } def prereqs ARGV << '--help' if ARGV.empty? opts = OptionParser.new do |opts| opts.banner = "Usage: #{File.basename($0)}" opts.separator '' opts.on_tail('-h', '--help', 'Show this message') do puts opts exit 0 end opts.on('--verbose', '-v', 'verbose') do LOGGER.level = Logger::DEBUG end opts.on("--develop", "Run in developer mode") do @options[:context] = :develop end end opts.parse! required_vars = %w[ ] required_vars.each do |v| raise "#{v} must be specified in the environment variables" unless ENV[v] end raise "jq not installed" unless Yq.which('jq') end def start begin @yaml = $stdin.read puts Yq.search_yaml(ARGV[0], @yaml) rescue => e LOGGER.error "Unhandled exception #{e.class}: #{e.message}" e.backtrace.each do |v| LOGGER.debug v end raise end end def develop require 'pry' LOGGER.level = Logger::DEBUG LOGGER.info "Develop mode" start end def main_loop start end prereqs self.send(@options[:context])
Version data entries
7 entries across 7 versions & 1 rubygems
Version | Path |
---|---|
yq-0.3.1 | bin/yq |
yq-0.3.0 | bin/yq |
yq-0.2.0 | bin/yq |
yq-0.1.1 | bin/yq |
yq-0.1.0 | bin/yq |
yq-0.0.3 | bin/yq |
yq-0.0.2 | bin/yq |