Sha256: 37c4b9bd98baf90cb5eff295e8f453a88c2b31bfac2850ab6b315bb83e682833

Contents?: true

Size: 556 Bytes

Versions: 13

Compression:

Stored size: 556 Bytes

Contents

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

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
p4util-0.4.3 ./lib/p4util.rb
p4util-0.4.2 ./lib/p4util.rb
p4util-0.4.1 ./lib/p4util.rb
p4util-0.4 ./lib/p4util.rb
p4util-0.3.1 ./lib/p4util.rb
p4util-0.3.0 ./lib/p4util.rb
p4util-0.2 ./lib/p4util.rb
p4util-0.1.6 ./lib/p4util.rb
p4util-0.1.5 ./lib/p4util.rb
p4util-0.1.4 ./lib/p4util.rb
p4util-0.1.3 ./lib/p4util.rb
p4util-0.1.1 ./lib/p4util.rb
p4util-0.1.0 ./lib/p4util.rb