Sha256: c2060a0277b4a5a51048b112b909100ead9d8f602fa100ec7c93528c06fcdccf

Contents?: true

Size: 1.68 KB

Versions: 6

Compression:

Stored size: 1.68 KB

Contents

#!/usr/bin/env ruby


# Requirements
# =======================================================================

# Stdlib
# -----------------------------------------------------------------------

# Deps
# -----------------------------------------------------------------------

# Project / Package
# -----------------------------------------------------------------------

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

require 'nrser'
require 'cmds'

require 'qb'


# Refinements
# =======================================================================

using NRSER


# Definitions
# =======================================================================

def main args
  Thread.current.name = 'main'
  logger = SemanticLogger['qb/exe/qb#main']
  
  QB::CLI.set_debug! args
  logger.debug args: args
  
  QB.check_ansible_version
  
  logger.debug "Main switch arg" => args[0]
  
  method_name, method_args = case args[0]
  when nil, '-h', '--help', 'help'
    [:help, []]
  when 'play'
    [:play, args.rest]
  when 'run'
    [:run, args.rest]
  when 'setup'
    [:setup, args.rest]
  when 'list', 'ls'
    [:list, *args.rest]
  else
    # default to `run` on the full args
    [:run, args]
  end
  
  logger.debug "Calling QB::CLI.#{ method_name }",
    method_args: method_args
  
  status = begin
    QB::CLI.public_send method_name, method_args
  rescue Exception => error
    raise error
  end
  
  logger.debug "QB::CLI.#{ method_name } returned, exiting.", status: status
  exit status
end


# Execution
# ============================================================================

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
qb-0.3.23 exe/qb
qb-0.3.22 exe/qb
qb-0.3.21 exe/qb
qb-0.3.20 exe/qb
qb-0.3.19 exe/qb
qb-0.3.18 exe/qb