class Seeker::CLI

Constants

NETRC_MACHINE

Attributes

result[R]

Public Class Methods

new() click to toggle source
# File lib/seeker/cli.rb, line 13
def initialize
  @opts = opts_parse
  if not @opts.present? :debug
    Seeker.debug = 0
  elsif @opts[:debug]
    Seeker.debug = @opts[:debug].to_i
  else
    Seeker.debug = 1
  end
  Log.level = Logger::DEBUG if Seeker.debug > 0
  args = @opts.parse
  @host = args.first
  raise MissingHost, 'no host given as argument' unless @host
  @user, @password = netrc_get
  @result = seek
end

Private Instance Methods

netrc_get(machine=NETRC_MACHINE) click to toggle source
# File lib/seeker/cli.rb, line 30
def netrc_get machine=NETRC_MACHINE
  auth = Net::Netrc.locate machine
  [auth.login, auth.password] rescue raise NoAuthFound, "could not find authentication for #{machine} in .netrc"
end