Class: Net::SSH::Locate::App

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/net/ssh/locate.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/net/ssh/locate.rb', line 11

def self.banner
  <<-LONGDESC
ssh-locate will search for a running ssh-agent and output the environment
  variables needed to contact it.

  To make sure that you're selecting the agent you launched and not the agent
  launched by your Desktop Environment, you must use the -a option to specify
  a socket path:

  $ ssh-agent -a /tmp/zed
  SSH_AUTH_SOCK=/tmp/zed; export SSH_AUTH_SOCK;
  SSH_AGENT_PID=1908155; export SSH_AGENT_PID;
  echo Agent pid 1908155;

  Then later in another shell instance:

  $ ssh-locate
  SSH_AUTH_SOCK=/tmp/zed; export SSH_AUTH_SOCK;
  SSH_AGENT_PID=1908155; export SSH_AGENT_PID;
  echo Agent pid 1908155;
  LONGDESC
end

Instance Method Details

#locate_agentObject



36
37
38
39
# File 'lib/net/ssh/locate.rb', line 36

def locate_agent
  @scanner = Scanner.new
  @scanner.scan
end


41
42
43
44
45
46
47
48
49
50
51
# File 'lib/net/ssh/locate.rb', line 41

def print_shell_commands
  return unless @scanner.found?

  if options[:emacs]
    emacsOutput
  elsif usingFish?
    fishOutput
  else
    bashOutput
  end
end