blob: 3833d11a757f48791c32f9d4a1bad1bcdb388911 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#!/usr/bin/env ruby
require 'optparse'
require 'sshconfig'
include SSHConfig
output = $stdout
input = File.join(ENV["HOME"], ".ssh/sshconfig")
parser = OptionParser.new do |opts|
opts.banner = "Usage: ssh-update-config"
opts.on("-h", "--help", "--usage", "Print usage") do
puts parser.banner
puts parser.summarize
exit 0
end
opts.on("-o MANDATORY", "--output MANDATORY", "Output destination (default: stdout)") do |out|
output = File.open(out, "w")
end
opts.on("-i MANDATORY", "--input MANDATORY", "Input source (default: ~/.ssh/sshconfig") do |inp|
input = inp
end
opts.on("-l MANDATORY", "--load MANDATORY", "Load an SSHConfig extension") do |ext|
require ext
end
end
parser.parse!
load input
output.puts $hostlist
output.flush
|