ssh-config 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES +8 -0
- data/README.rdoc +11 -1
- data/bin/ssh-config +1 -1
- data/lib/config_file.rb +8 -3
- metadata +2 -2
data/CHANGES
CHANGED
data/README.rdoc
CHANGED
@@ -31,7 +31,7 @@ from a section, the section is NOT removed; use rm <host> for that.
|
|
31
31
|
|
32
32
|
Removes an entire host section.
|
33
33
|
|
34
|
-
=== copy <old_host> <new_host>
|
34
|
+
=== copy <old_host> <new_host> [<key> <value> [...]]
|
35
35
|
|
36
36
|
Copies the entire section named <old_host> to a new section called
|
37
37
|
<new_host>. If old_host has a Hostname section, ssh-config will try to
|
@@ -47,6 +47,16 @@ look like this:
|
|
47
47
|
Host rails02
|
48
48
|
Hostname rails02.example.com
|
49
49
|
|
50
|
+
You can manually override any setting, and/or set new ones by
|
51
|
+
appending the new key/value pairs at the end. Given the rails01
|
52
|
+
section above, "ssh-config copy rails01 rails02 Hostname
|
53
|
+
rails-02.example.com User dbrady" would emit
|
54
|
+
|
55
|
+
Host rails02
|
56
|
+
Hostname rails-02.example.com
|
57
|
+
User dbrady
|
58
|
+
|
59
|
+
|
50
60
|
=== dump
|
51
61
|
|
52
62
|
Dumps the entire file.
|
data/bin/ssh-config
CHANGED
@@ -54,7 +54,7 @@ when 'search'
|
|
54
54
|
search = argv.shift
|
55
55
|
puts config.search(search).gsub(search, "\033[43m#{search}\033[0m")
|
56
56
|
when 'cp', 'copy'
|
57
|
-
config.copy! argv.shift, argv.shift
|
57
|
+
config.copy! argv.shift, argv.shift, *argv
|
58
58
|
when 'unset'
|
59
59
|
config.unset!(argv.shift, *argv)
|
60
60
|
when 'set'
|
data/lib/config_file.rb
CHANGED
@@ -89,13 +89,13 @@ class ConfigFile
|
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|
92
|
-
def copy!(old_host_nick, new_host_nick)
|
92
|
+
def copy!(old_host_nick, new_host_nick, *args)
|
93
93
|
backup if @make_backups
|
94
|
-
copy(old_host_nick, new_host_nick)
|
94
|
+
copy(old_host_nick, new_host_nick, *args)
|
95
95
|
save
|
96
96
|
end
|
97
97
|
|
98
|
-
def copy(old_host_nick, new_host_nick)
|
98
|
+
def copy(old_host_nick, new_host_nick, *args)
|
99
99
|
if @sections_by_name.key?(old_host_nick)
|
100
100
|
old_section = @sections_by_name[old_host_nick]
|
101
101
|
new_section = @sections_by_name[new_host_nick] || add_section(new_host_nick)
|
@@ -104,6 +104,11 @@ class ConfigFile
|
|
104
104
|
if old_section["Hostname"]
|
105
105
|
new_section["Hostname"] = old_section["Hostname"].gsub(old_host_nick, new_host_nick)
|
106
106
|
end
|
107
|
+
|
108
|
+
while args.length > 0
|
109
|
+
key, value = args.shift, args.shift
|
110
|
+
section = set(new_host_nick, key, value)
|
111
|
+
end
|
107
112
|
end
|
108
113
|
end
|
109
114
|
|