Method: Sshx::Cli.get_hosts
- Defined in:
- lib/sshx/cli.rb
.get_hosts ⇒ Object
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 |
# File 'lib/sshx/cli.rb', line 226 def get_hosts() hosts = [] open(@@ssh_config_path) {|file| while line = file.gets line = line.chomp matches = line.scan(/Host\s+([^\s]+)/i) if matches.length == 0 next end hosts.push(matches[0][0]) end } return hosts end |