i2cssh 1.3.4 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +18 -6
- data/VERSION +1 -1
- data/bin/i2cssh +78 -24
- data/i2cssh.gemspec +2 -2
- metadata +4 -4
data/README.markdown
CHANGED
@@ -16,35 +16,47 @@ to all sessions.
|
|
16
16
|
-C, --columns COLUMNS Number of columns (rows will be calculated)
|
17
17
|
-R, --rows ROWS Number of rows (columns will be calculated)
|
18
18
|
-b, --broadcast Start with broadcast input (DANGEROUS!)
|
19
|
+
-nb, --nobroadcast Disable broadcast
|
19
20
|
-p, --profile PROFILE Name of the iTerm2 profile (default: Default)
|
20
21
|
-2, --iterm2 Use iTerm2 instead of iTerm
|
21
22
|
-f, --file FILE Cluster file (one hostname per line)
|
22
23
|
-c, --cluster CLUSTERNAME Name of the cluster specified in ~/.i2csshrc
|
23
24
|
-m, --machines a,b,c Comma-separated list of hosts
|
24
25
|
|
25
|
-
|
26
|
+
For -c and -m options, the format username@cluster or username@host.
|
26
27
|
|
27
28
|
## i2csshrc
|
28
29
|
|
29
30
|
The i2csshrc file is a YAML formatted file that contains the following structure:
|
30
31
|
|
31
32
|
---
|
33
|
+
version: 2 # Mandatory. Current version is 2
|
34
|
+
iterm2: false # Optional. Set to true if you use iTerm2.app instead of iTerm.app.
|
35
|
+
broadcast: false # Optional. Set to true if you want to enable broadcast for all clusters.
|
36
|
+
login: myusername # Optional. Always use this username.
|
32
37
|
clusters:
|
33
38
|
mycluster:
|
34
|
-
|
35
|
-
|
36
|
-
|
39
|
+
broadcast: false # Optional. Set to true if you want to enable broadcast for this cluster.
|
40
|
+
login: false # Optional. Set to true if you want a specific login for this cluster.
|
41
|
+
hosts:
|
42
|
+
- host1
|
43
|
+
- host2
|
44
|
+
- ...
|
45
|
+
|
46
|
+
The following precedence is used:
|
47
|
+
|
48
|
+
global options from config < cluster options from config < command line flags
|
37
49
|
|
38
50
|
Make sure the config file is valid YAML (e.g. use spaces instead of tabs)
|
39
51
|
|
40
52
|
## Known issues
|
41
53
|
|
42
54
|
- i2cssh uses rb-appscript and that only seems to work on ruby 1.8.7 and breaks on 1.9.x
|
55
|
+
- Only a single username can be used when using -m username@host.
|
43
56
|
|
44
57
|
## TODO
|
45
58
|
|
46
59
|
- Functional parity with csshX (as far as possible)
|
47
|
-
- Being able to specify an iTerm2 profile
|
48
60
|
|
49
61
|
## Contributing to i2cssh
|
50
62
|
|
@@ -61,6 +73,6 @@ fork, hack and create a pull request.
|
|
61
73
|
|
62
74
|
## Copyright
|
63
75
|
|
64
|
-
Copyright (c) 2011 Wouter de Bie. See LICENSE.txt for
|
76
|
+
Copyright (c) 2011-2012 Wouter de Bie. See LICENSE.txt for
|
65
77
|
further details.
|
66
78
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.4.0
|
data/bin/i2cssh
CHANGED
@@ -2,12 +2,79 @@
|
|
2
2
|
require 'rubygems'
|
3
3
|
require 'optparse'
|
4
4
|
require 'i2cssh'
|
5
|
+
require 'yaml'
|
6
|
+
require 'pp'
|
7
|
+
config_file = File.expand_path "~/.i2csshrc"
|
5
8
|
|
6
|
-
i2_options, ssh_options, servers = {}, [], []
|
9
|
+
i2_options, ssh_options, servers, clusters, login_from_cli = {}, [], [], {}, false
|
10
|
+
|
11
|
+
if File.exists?(config_file)
|
12
|
+
config_hash = YAML.load File.read config_file
|
13
|
+
|
14
|
+
# Read config and set defaults from config
|
15
|
+
if config_hash["version"] && config_hash["version"].to_i >= 2 then
|
16
|
+
clusters = config_hash["clusters"]
|
17
|
+
|
18
|
+
# 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
|
+
|
23
|
+
else
|
24
|
+
# Convert version 1 format to version 2
|
25
|
+
clusters = config_hash["clusters"].inject({}){|m, c| m[c[0]] = {"hosts" => c[1]}; m}
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
7
29
|
|
8
30
|
optparse = OptionParser.new do |opts|
|
9
31
|
opts.banner = "Usage: #{File.basename(__FILE__)} [options]"
|
10
32
|
|
33
|
+
# Check if we have a cluster.
|
34
|
+
opts.on '-c', '--cluster CLUSTERNAME',
|
35
|
+
'Name of the cluster specified in ~/.i2csshrc' do |c|
|
36
|
+
|
37
|
+
if c =~ /(.+)@(.+)/ then
|
38
|
+
login_from_cli = $1
|
39
|
+
c = $2
|
40
|
+
end
|
41
|
+
|
42
|
+
cluster = clusters[c]
|
43
|
+
|
44
|
+
if clusters
|
45
|
+
cluster_hosts = cluster["hosts"]
|
46
|
+
|
47
|
+
i2_options[:login_override] = cluster["login"] || i2_options[:login_override]
|
48
|
+
i2_options[:login_override] = login_from_cli if login_from_cli
|
49
|
+
i2_options[:broadcast] = cluster["broadcast"] || i2_options[:broadcast]
|
50
|
+
|
51
|
+
servers += cluster_hosts
|
52
|
+
else
|
53
|
+
puts "ERROR: unknown cluster #{c}"
|
54
|
+
puts optparse.help
|
55
|
+
exit 1
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
opts.on '-m', '--machines a,b,c', Array,
|
60
|
+
'Comma-separated list of hosts' do |h|
|
61
|
+
h.each do |host|
|
62
|
+
if host =~ /(.+)@(.+)/ then
|
63
|
+
i2_options[:login_override] = $1
|
64
|
+
host = $2
|
65
|
+
end
|
66
|
+
servers << host
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# Hosts
|
71
|
+
opts.on '-f', '--file FILE',
|
72
|
+
'Cluster file (one hostname per line)' do |f|
|
73
|
+
servers += File.read(f).split "\n"
|
74
|
+
end
|
75
|
+
|
76
|
+
# Command line options override config file
|
77
|
+
|
11
78
|
# SSH options
|
12
79
|
opts.on '-A', '--forward-agent',
|
13
80
|
'Enable SSH agent forwarding' do
|
@@ -15,7 +82,8 @@ optparse = OptionParser.new do |opts|
|
|
15
82
|
end
|
16
83
|
opts.on '-l', '--login LOGIN',
|
17
84
|
'SSH login name' do |u|
|
18
|
-
|
85
|
+
i2_options[:login_override] = u
|
86
|
+
|
19
87
|
end
|
20
88
|
|
21
89
|
# iTerm2 options
|
@@ -41,6 +109,10 @@ optparse = OptionParser.new do |opts|
|
|
41
109
|
'Start with broadcast input (DANGEROUS!)' do
|
42
110
|
i2_options[:broadcast] = true
|
43
111
|
end
|
112
|
+
opts.on '-nb', '--nobroadcast',
|
113
|
+
'Disable broadcast' do
|
114
|
+
i2_options[:broadcast] = false
|
115
|
+
end
|
44
116
|
opts.on '-p', '--profile PROFILE',
|
45
117
|
'Name of the iTerm2 profile (default: Default)' do |p|
|
46
118
|
i2_options[:profile] = p
|
@@ -51,31 +123,13 @@ optparse = OptionParser.new do |opts|
|
|
51
123
|
i2_options[:iterm2] = true
|
52
124
|
end
|
53
125
|
|
54
|
-
# Hosts
|
55
|
-
opts.on '-f', '--file FILE',
|
56
|
-
'Cluster file (one hostname per line)' do |f|
|
57
|
-
servers += File.read(f).split "\n"
|
58
|
-
end
|
59
|
-
opts.on '-c', '--cluster CLUSTERNAME',
|
60
|
-
'Name of the cluster specified in ~/.i2csshrc' do |c|
|
61
|
-
require 'yaml'
|
62
|
-
config_hash = YAML.load File.read File.expand_path '~/.i2csshrc'
|
63
|
-
cluster = config_hash["clusters"][c]
|
64
|
-
if cluster
|
65
|
-
servers += cluster
|
66
|
-
else
|
67
|
-
puts "ERROR: unknown cluster #{c}"
|
68
|
-
puts optparse.help
|
69
|
-
exit 1
|
70
|
-
end
|
71
|
-
end
|
72
|
-
opts.on '-m', '--machines a,b,c', Array,
|
73
|
-
'Comma-separated list of hosts' do |h|
|
74
|
-
servers += h
|
75
|
-
end
|
76
126
|
end
|
77
127
|
optparse.parse!
|
78
128
|
|
129
|
+
if i2_options[:login_override] then
|
130
|
+
ssh_options << "-l #{i2_options[:login_override]}"
|
131
|
+
end
|
132
|
+
|
79
133
|
if servers.empty?
|
80
134
|
puts "ERROR: no servers given"
|
81
135
|
puts optparse.help
|
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.4.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-03-
|
12
|
+
s.date = "2012-03-21"
|
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: 7
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
- 3
|
9
8
|
- 4
|
10
|
-
|
9
|
+
- 0
|
10
|
+
version: 1.4.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-03-
|
18
|
+
date: 2012-03-21 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
prerelease: false
|