i2cssh 1.4.2 → 1.4.3
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/README.markdown +3 -1
- data/VERSION +1 -1
- data/bin/i2cssh +59 -53
- data/i2cssh.gemspec +2 -2
- metadata +4 -4
data/README.markdown
CHANGED
@@ -9,7 +9,7 @@ to all sessions.
|
|
9
9
|
$ gem install i2cssh
|
10
10
|
|
11
11
|
## Usage
|
12
|
-
Usage: i2cssh [options]
|
12
|
+
Usage: i2cssh [options] [(username@host [username@host] | username@cluster)]
|
13
13
|
-A, --forward-agent Enable SSH agent forwarding
|
14
14
|
-l, --login LOGIN SSH login name
|
15
15
|
-F, --fullscreen Make the window fullscreen
|
@@ -23,6 +23,8 @@ to all sessions.
|
|
23
23
|
-c, --cluster CLUSTERNAME Name of the cluster specified in ~/.i2csshrc
|
24
24
|
-m, --machines a,b,c Comma-separated list of hosts
|
25
25
|
|
26
|
+
i2cssh will assume you want to connect to a cluster when only one host is given.
|
27
|
+
|
26
28
|
For `-c` and `-m` options, the format `username@cluster` or `username@host` can be used.
|
27
29
|
|
28
30
|
The following commands are exactly the same, however, they might serve different purposes:
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.4.
|
1
|
+
1.4.3
|
data/bin/i2cssh
CHANGED
@@ -3,23 +3,51 @@ require 'rubygems'
|
|
3
3
|
require 'optparse'
|
4
4
|
require 'i2cssh'
|
5
5
|
require 'yaml'
|
6
|
+
require 'pp'
|
6
7
|
|
7
|
-
config_file = File.expand_path "~/.i2csshrc"
|
8
|
+
@config_file = File.expand_path "~/.i2csshrc"
|
8
9
|
|
9
|
-
i2_options, ssh_options, servers, clusters
|
10
|
+
@i2_options, ssh_options, @servers, @clusters = {}, [], [], {}
|
10
11
|
|
11
|
-
|
12
|
-
|
12
|
+
def get_hosts(c)
|
13
|
+
if c =~ /(.+)@(.+)/ then
|
14
|
+
login_from_cli = $1
|
15
|
+
c = $2
|
16
|
+
end
|
17
|
+
|
18
|
+
cluster = @clusters[c]
|
19
|
+
|
20
|
+
if cluster
|
21
|
+
cluster_hosts = cluster["hosts"]
|
22
|
+
|
23
|
+
@i2_options[:login_override] = cluster["login"] || @i2_options[:login_override]
|
24
|
+
@i2_options[:login_override] = login_from_cli if login_from_cli
|
25
|
+
@i2_options[:broadcast] = cluster["broadcast"] || @i2_options[:broadcast]
|
26
|
+
@i2_options[:profile] = cluster["profile"] || @i2_options[:profile]
|
27
|
+
|
28
|
+
if @i2_options[:login_override] then
|
29
|
+
cluster_hosts = cluster_hosts.map{|h| "#{@i2_options[:login_override]}@#{h}"}
|
30
|
+
end
|
31
|
+
|
32
|
+
@servers += cluster_hosts
|
33
|
+
else
|
34
|
+
puts "ERROR: unknown cluster #{c}. Check your #{@config_file}"
|
35
|
+
exit 1
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
if File.exists?(@config_file)
|
40
|
+
config_hash = YAML.load File.read @config_file
|
13
41
|
|
14
42
|
# Read config and set defaults from config
|
15
43
|
if config_hash["version"] && config_hash["version"].to_i >= 2 then
|
16
|
-
clusters = config_hash["clusters"]
|
44
|
+
@clusters = config_hash["clusters"]
|
17
45
|
|
18
46
|
# Options from the config file
|
19
|
-
i2_options[:iterm2] = config_hash["iterm2"]
|
20
|
-
i2_options[:login_override] = config_hash["login"]
|
21
|
-
i2_options[:broadcast] = config_hash["broadcast"]
|
22
|
-
i2_options[:profile] = config_hash["profile"]
|
47
|
+
@i2_options[:iterm2] = config_hash["iterm2"]
|
48
|
+
@i2_options[:login_override] = config_hash["login"]
|
49
|
+
@i2_options[:broadcast] = config_hash["broadcast"]
|
50
|
+
@i2_options[:profile] = config_hash["profile"]
|
23
51
|
|
24
52
|
else
|
25
53
|
# Convert version 1 format to version 2
|
@@ -29,48 +57,23 @@ if File.exists?(config_file)
|
|
29
57
|
end
|
30
58
|
|
31
59
|
optparse = OptionParser.new do |opts|
|
32
|
-
opts.banner = "Usage: #{File.basename(__FILE__)} [options] [username@host [username@host]]"
|
60
|
+
opts.banner = "Usage: #{File.basename(__FILE__)} [options] [(username@host [username@host] | username@cluster)]"
|
33
61
|
|
34
62
|
# Check if we have a cluster.
|
35
63
|
opts.on '-c', '--cluster CLUSTERNAME',
|
36
64
|
'Name of the cluster specified in ~/.i2csshrc' do |c|
|
37
|
-
|
38
|
-
if c =~ /(.+)@(.+)/ then
|
39
|
-
login_from_cli = $1
|
40
|
-
c = $2
|
41
|
-
end
|
42
|
-
|
43
|
-
cluster = clusters[c]
|
44
|
-
|
45
|
-
if clusters
|
46
|
-
cluster_hosts = cluster["hosts"]
|
47
|
-
|
48
|
-
i2_options[:login_override] = cluster["login"] || i2_options[:login_override]
|
49
|
-
i2_options[:login_override] = login_from_cli if login_from_cli
|
50
|
-
i2_options[:broadcast] = cluster["broadcast"] || i2_options[:broadcast]
|
51
|
-
i2_options[:profile] = cluster["profile"] || i2_options[:profile]
|
52
|
-
|
53
|
-
if i2_options[:login_override] then
|
54
|
-
cluster_hosts = cluster_hosts.map{|h| "#{i2_options[:login_override]}@#{h}"}
|
55
|
-
end
|
56
|
-
|
57
|
-
servers += cluster_hosts
|
58
|
-
else
|
59
|
-
puts "ERROR: unknown cluster #{c}"
|
60
|
-
puts optparse.help
|
61
|
-
exit 1
|
62
|
-
end
|
65
|
+
get_hosts(c)
|
63
66
|
end
|
64
67
|
|
65
68
|
opts.on '-m', '--machines a,b,c', Array,
|
66
69
|
'Comma-separated list of hosts' do |h|
|
67
|
-
servers += h
|
70
|
+
@servers += h
|
68
71
|
end
|
69
72
|
|
70
73
|
# Hosts
|
71
74
|
opts.on '-f', '--file FILE',
|
72
75
|
'Cluster file (one hostname per line)' do |f|
|
73
|
-
servers += File.read(f).split "\n"
|
76
|
+
@servers += File.read(f).split "\n"
|
74
77
|
end
|
75
78
|
|
76
79
|
# Command line options override config file
|
@@ -82,62 +85,65 @@ optparse = OptionParser.new do |opts|
|
|
82
85
|
end
|
83
86
|
opts.on '-l', '--login LOGIN',
|
84
87
|
'SSH login name' do |u|
|
85
|
-
i2_options[:login_override] = u
|
88
|
+
@i2_options[:login_override] = u
|
86
89
|
|
87
90
|
end
|
88
91
|
|
89
92
|
# iTerm2 options
|
90
93
|
opts.on '-F', '--fullscreen',
|
91
94
|
'Make the window fullscreen' do
|
92
|
-
i2_options[:fullscreen] = true
|
95
|
+
@i2_options[:fullscreen] = true
|
93
96
|
end
|
94
97
|
opts.on '-C', '--columns COLUMNS', Integer,
|
95
98
|
'Number of columns (rows will be calculated)' do |c|
|
96
|
-
i2_options[:columns] = c
|
99
|
+
@i2_options[:columns] = c
|
97
100
|
end
|
98
101
|
opts.on '-R', '--rows ROWS', Integer,
|
99
102
|
'Number of rows (columns will be calculated)' do |r|
|
100
|
-
if i2_options[:columns]
|
103
|
+
if @i2_options[:columns]
|
101
104
|
puts "ERROR: -C and -R can't be used at the same time"
|
102
105
|
puts optparse.help
|
103
106
|
exit
|
104
107
|
else
|
105
|
-
i2_options[:rows] = r
|
108
|
+
@i2_options[:rows] = r
|
106
109
|
end
|
107
110
|
end
|
108
111
|
opts.on '-b', '--broadcast',
|
109
112
|
'Start with broadcast input (DANGEROUS!)' do
|
110
|
-
i2_options[:broadcast] = true
|
113
|
+
@i2_options[:broadcast] = true
|
111
114
|
end
|
112
115
|
opts.on '-nb', '--nobroadcast',
|
113
116
|
'Disable broadcast' do
|
114
|
-
i2_options[:broadcast] = false
|
117
|
+
@i2_options[:broadcast] = false
|
115
118
|
end
|
116
119
|
opts.on '-p', '--profile PROFILE',
|
117
120
|
'Name of the iTerm2 profile (default: Default)' do |p|
|
118
|
-
i2_options[:profile] = p
|
121
|
+
@i2_options[:profile] = p
|
119
122
|
puts p
|
120
123
|
end
|
121
124
|
opts.on "-2", '--iterm2',
|
122
125
|
'Use iTerm2 instead of iTerm' do
|
123
|
-
i2_options[:iterm2] = true
|
126
|
+
@i2_options[:iterm2] = true
|
124
127
|
end
|
125
128
|
|
126
129
|
end
|
127
130
|
optparse.parse!
|
128
131
|
|
129
|
-
if ARGV.length
|
130
|
-
|
132
|
+
if ARGV.length == 1 then
|
133
|
+
c = ARGV[0]
|
134
|
+
get_hosts(c)
|
135
|
+
elsif ARGV.length > 1 then
|
136
|
+
@servers = ARGV
|
131
137
|
end
|
132
138
|
|
133
|
-
if i2_options[:login_override] then
|
134
|
-
servers = servers.map{|h| "#{i2_options[:login_override]}@#{h.gsub(/.+@/,'')}"}
|
139
|
+
if @i2_options[:login_override] then
|
140
|
+
@servers = @servers.map{|h| "#{@i2_options[:login_override]}@#{h.gsub(/.+@/,'')}"}
|
135
141
|
end
|
136
142
|
|
137
|
-
if servers.empty?
|
143
|
+
if @servers.empty?
|
138
144
|
puts "ERROR: no servers given"
|
139
145
|
puts optparse.help
|
140
146
|
exit
|
141
147
|
end
|
142
148
|
|
143
|
-
I2Cssh.new servers, ssh_options, i2_options
|
149
|
+
I2Cssh.new @servers, ssh_options, @i2_options
|
data/i2cssh.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "i2cssh"
|
8
|
-
s.version = "1.4.
|
8
|
+
s.version = "1.4.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Wouter de Bie"]
|
12
|
-
s.date = "2012-03-
|
12
|
+
s.date = "2012-03-22"
|
13
13
|
s.description = "csshX like cluster ssh using iTerm2 panes"
|
14
14
|
s.email = "wouter@evenflow.se"
|
15
15
|
s.executables = ["i2cssh"]
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: i2cssh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 1
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 1.4.
|
9
|
+
- 3
|
10
|
+
version: 1.4.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Wouter de Bie
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-03-
|
18
|
+
date: 2012-03-22 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
prerelease: false
|