class Options

Public Class Methods

reset() click to toggle source
# File lib/branch_cli/options.rb, line 6
def self.reset
  @sharedInstance = nil
end
sharedInstance() click to toggle source
# File lib/branch_cli/options.rb, line 2
def self.sharedInstance
  @sharedInstance ||= Options.new
end

Public Instance Methods

isBranchSupplied() click to toggle source
# File lib/branch_cli/options.rb, line 19
def isBranchSupplied
  return suppliedBranch != nil
end
loadOptions(arguments: nil) click to toggle source
# File lib/branch_cli/options.rb, line 23
def loadOptions(arguments: nil)
  if arguments.contains("help") || arguments.contains("--help")
    self.isHelp = true
  end

  if arguments.contains("--verbose")
    self.isVerbose = true
  end

  if arguments.contains("-v") || arguments.contains("--version")
    self.isShowVersion = true
  end

  if arguments.contains("--test-rebase")
    self.isTestRebase = true
  end

  if arguments.contains("--list") || arguments.contains("-l")
    self.isShowList = true
  end

  if arguments.contains("--prefer=local")
    self.preferLocal = true
  end

  if arguments.contains("--prefer=remote")
    self.preferRemote = true
  end

  if arguments.count > 0
    if !arguments[0].hasPrefix("-")
      self.suppliedBranch = arguments[0]
    end
  end
end