require 'p4util/version' require 'commands' require 'optparse' require 'ostruct' module P4Util def P4Util.run(args) options = parse_options(args) Commands.method(options.command).call(options) end # Returns the options as an OpenStruct object def P4Util.parse_options(args) options = OpenStruct.new options.command = :help options.params = [] if args && !args.empty? options.command = args.first.to_sym if args.length > 1 options.params.concat(args.drop(1)) end end options end end