class P4Tools::Describe

Public Class Methods

new(args) click to toggle source
# File lib/commands/describe.rb, line 20
def initialize(args)
  @pending = args[:pending]
  @submitted = args[:submitted]

  @p4 = P4Tools.connection
end
run(arguments) click to toggle source
# File lib/commands/describe.rb, line 4
def self.run(arguments)
  Describe.new(arguments).run
end
set_options(opts) click to toggle source
# File lib/commands/describe.rb, line 8
def self.set_options(opts)
  opts.set do
    help 'Provides information about changelists and the changelists files.'
    help ''
    help 'Options:'
    help ''
    arg :submitted, 'Find pending CL number, based on submitted CL number.', :short => '-s', :type => :ints
    arg :pending, 'Find submitted CL number, based on pending CL number.', :short => '-p', :type => :ints
  end
end

Public Instance Methods

find_pending() click to toggle source
# File lib/commands/describe.rb, line 41
def find_pending
  @p4.run_describe('-s', @submitted)
end
find_submitted() click to toggle source
# File lib/commands/describe.rb, line 37
def find_submitted
  @p4.run_describe('-s', '-O', @pending)
end
report(numbers) click to toggle source
# File lib/commands/describe.rb, line 45
def report(numbers)
  numbers.each { |num|
    p "pending: #{num['oldChange']}, submitted: #{num['change']}"
  }
end
run() click to toggle source
# File lib/commands/describe.rb, line 27
def run
  if !@submitted.nil?
    numbers = find_pending
    report(numbers)
  elsif !@pending.nil?
    numbers = find_submitted
    report(numbers)
  end
end