Sha256: 443131dbec6b4af1b4e1f4b50cf274f285d517d430869fa8e33b7a89940ad58d
Contents?: true
Size: 1.74 KB
Versions: 1
Compression:
Stored size: 1.74 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 = NRSER::Logging['qb/exe/qb#main'] QB::CLI.set_debug! args NRSER::Logging.setup_for_cli! application: 'qb' 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
qb-0.3.25 | exe/qb |