i2cssh 1.5.4 → 1.6.0
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 -0
- data/VERSION +1 -1
- data/bin/i2cssh +16 -1
- data/i2cssh.gemspec +2 -2
- data/lib/i2cssh.rb +17 -9
- metadata +5 -5
data/README.markdown
CHANGED
@@ -24,6 +24,7 @@ to all sessions.
|
|
24
24
|
-c, --cluster CLUSTERNAME Name of the cluster specified in ~/.i2csshrc
|
25
25
|
-r, --rank Send LC_RANK with the host number as environment variable
|
26
26
|
-m, --machines a,b,c Comma-separated list of hosts
|
27
|
+
-s, --sleep SLEEP Number of seconds to sleep between creating SSH sessions
|
27
28
|
|
28
29
|
i2cssh will assume you want to connect to a cluster when only one host is given.
|
29
30
|
|
@@ -62,6 +63,8 @@ Optional parameters can be used globablly or per cluster and include:
|
|
62
63
|
rank: (true/false) # Enable sending LC_RANK as an environment variable
|
63
64
|
columns: <cols> # Amount of columns
|
64
65
|
rows: <rows> # Amount of rows
|
66
|
+
sleep: <secs> # Seconds to sleep between creating SSH sessions
|
67
|
+
direction: (column/row) # Direction that new sessions are created (default: column)
|
65
68
|
|
66
69
|
environment: # Send the following enviroment variables
|
67
70
|
- LC_FOO: foo
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.6.0
|
data/bin/i2cssh
CHANGED
@@ -36,11 +36,13 @@ def set_options(config_hash, login_override=nil)
|
|
36
36
|
exit 1
|
37
37
|
end
|
38
38
|
|
39
|
-
[:broadcast, :profile, :rank, :iterm2, :login_override, :columns, :rows].each do |p|
|
39
|
+
[:broadcast, :profile, :rank, :iterm2, :login_override, :columns, :rows, :sleep, :direction].each do |p|
|
40
40
|
@i2_options[p] = config_hash[p.to_s].nil? ? @i2_options[p] : config_hash[p.to_s]
|
41
41
|
end
|
42
42
|
|
43
43
|
@i2_options[:login_override] = login_override if login_override
|
44
|
+
@i2_options[:direction] ||= :column
|
45
|
+
@i2_options[:direction] = @i2_options[:direction].to_sym
|
44
46
|
|
45
47
|
@ssh_environment.merge!(config_hash["environment"].inject({}){|m, v| m.merge(v)}) if config_hash["environment"]
|
46
48
|
end
|
@@ -141,6 +143,19 @@ optparse = OptionParser.new do |opts|
|
|
141
143
|
'Use iTerm2 instead of iTerm' do
|
142
144
|
opts_from_cmdline[:iterm2] = true
|
143
145
|
end
|
146
|
+
opts.on '-s', '--sleep SLEEP', Float,
|
147
|
+
'Number of seconds to sleep between creating SSH sessions' do |s|
|
148
|
+
opts_from_cmdline[:sleep] = s
|
149
|
+
end
|
150
|
+
opts.on "-d", '--direction DIRECTION', String,
|
151
|
+
'Direction that new sessions are created (default: column)' do |d|
|
152
|
+
unless ["row", "column"].include?(d) then
|
153
|
+
puts "ERROR: -d requires 'row' or 'column'"
|
154
|
+
puts optparse.help
|
155
|
+
exit 1
|
156
|
+
end
|
157
|
+
opts_from_cmdline[:direction] = d.to_sym
|
158
|
+
end
|
144
159
|
|
145
160
|
end
|
146
161
|
optparse.parse!
|
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.
|
8
|
+
s.version = "1.6.0"
|
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-
|
12
|
+
s.date = "2012-11-12"
|
13
13
|
s.description = "csshX like cluster ssh using iTerm2 panes"
|
14
14
|
s.email = "wouter@evenflow.se"
|
15
15
|
s.executables = ["i2cssh"]
|
data/lib/i2cssh.rb
CHANGED
@@ -52,18 +52,24 @@ class I2Cssh
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def split_session
|
55
|
+
splitmap = {
|
56
|
+
:column => {0 => "d", 1 => 123, 2 => "D", 3=> 124, :x => @columns, :y => @rows},
|
57
|
+
:row => {0 => "D", 1=> 126, 2 => "d", 3=> 125, :x => @rows, :y => @columns}
|
58
|
+
}
|
59
|
+
splitconfig = splitmap[@i2_options[:direction]]
|
60
|
+
|
55
61
|
first = true
|
56
|
-
2.upto
|
57
|
-
@sys_events.keystroke
|
62
|
+
2.upto splitconfig[:x] do
|
63
|
+
@sys_events.keystroke splitconfig[0], :using => :command_down
|
58
64
|
end
|
59
|
-
2.upto
|
60
|
-
1.upto
|
61
|
-
@sys_events.key_code
|
65
|
+
2.upto splitconfig[:y] do
|
66
|
+
1.upto splitconfig[:x] do
|
67
|
+
@sys_events.key_code splitconfig[1], :using => [:command_down, :option_down] unless first
|
62
68
|
first = false
|
63
69
|
end
|
64
|
-
|
65
|
-
@sys_events.keystroke
|
66
|
-
@sys_events.key_code
|
70
|
+
splitconfig[:x].times do |x|
|
71
|
+
@sys_events.keystroke splitconfig[2], :using => :command_down
|
72
|
+
@sys_events.key_code splitconfig[3], :using => [:command_down, :option_down] unless @columns - 1 == x
|
67
73
|
end
|
68
74
|
end
|
69
75
|
end
|
@@ -88,7 +94,9 @@ class I2Cssh
|
|
88
94
|
send_env = "-o SendEnv=#{@ssh_environment.keys.join(",")}"
|
89
95
|
@term.sessions[i].write :text => "#{@ssh_environment.map{|k,v| "export #{k}=#{v}"}.join('; ')}"
|
90
96
|
end
|
91
|
-
|
97
|
+
if @i2_options[:sleep] then
|
98
|
+
sleep @i2_options[:sleep] * i
|
99
|
+
end
|
92
100
|
@term.sessions[i].write :text => "unset HISTFILE && echo -e \"\\033]50;SetProfile=#{@profile}\\a\" && #{@ssh_prefix} #{send_env} #{server}"
|
93
101
|
else
|
94
102
|
|
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: 15
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 1.
|
8
|
+
- 6
|
9
|
+
- 0
|
10
|
+
version: 1.6.0
|
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-
|
18
|
+
date: 2012-11-12 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
prerelease: false
|