Module: P4Util

Defined in:
lib/p4util.rb,
lib/p4util/tasks.rb,
lib/p4util/version.rb

Defined Under Namespace

Classes: Tasks

Constant Summary collapse

VERSION =
'0.4.3'

Class Method Summary collapse

Class Method Details

.parse_options(args) ⇒ Object

Returns the options as an OpenStruct object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/p4util.rb', line 14

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

.run(args) ⇒ Object



8
9
10
11
# File 'lib/p4util.rb', line 8

def P4Util.run(args)
  options = parse_options(args)
  Commands.method(options.command).call(options)
end