Sha256: d19028303d62cce2c0355c853810d023970581cadf9e28ff0176bb63355083ed

Contents?: true

Size: 1.07 KB

Versions: 4

Compression:

Stored size: 1.07 KB

Contents

#!/usr/bin/env ruby

require 'pathname'
require 'pp'
require 'yaml'
require 'json'
require 'fileutils'
require 'thread'

require 'cmds'

require 'qb'

require 'nrser/refinements'
using NRSER


DEBUG_ARGS = ['-D', '--DEBUG']


def set_debug! args
  if DEBUG_ARGS.any? {|arg| args.include? arg}
    QB::Util::Logging.setup level: :debug
    DEBUG_ARGS.each {|arg| args.delete arg}
  end
end


def main args
  Thread.current.name = 'main'
  logger = SemanticLogger['qb/exe/qb#main']
  
  set_debug! args
  logger.debug args: args
  
  QB.check_ansible_version
  
  logger.debug "Switch arg" => args[0]
  
  status = case args[0]
  when nil, '-h', '--help', 'help'
    QB::CLI.help
  when 'play'
    QB::CLI.play args.rest
  when 'run'
    QB::CLI.run args.rest
  when 'setup'
    state_args = args.rest
    
    case state_args[0]
    when nil
      QB::CLI.setup
    end
  else
    # default to `run` on the full args
    QB::CLI.run args
  end
  
  logger.debug "Exit status", status
  
  # exit status
  exit status
end


main(ARGV) # if __FILE__ == $0 # doesn't work with gem stub or something?

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
qb-0.3.12 exe/qb
qb-0.3.11 exe/qb
qb-0.3.10 exe/qb
qb-0.3.9 exe/qb