i2cssh 1.4.0 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
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]]
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,7 +23,18 @@ 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
- For -c and -m options, the format username@cluster or username@host.
26
+ For -c and -m options, the format username@cluster or username@host can be used.
27
+
28
+ The following commands are exactly the same, however, they might serve different purposes:
29
+
30
+ $ i2cssh -m user1@host1,user2@host2
31
+ $ i2cssh user1@host1 user2@host2
32
+
33
+ Using the -l option will override all usernames:
34
+
35
+ $ i2css -l foo user1@host1 user2@host2
36
+
37
+ This will connect to both host1 and host2 as the user foo
27
38
 
28
39
  ## i2csshrc
29
40
 
@@ -52,7 +63,6 @@ Make sure the config file is valid YAML (e.g. use spaces instead of tabs)
52
63
  ## Known issues
53
64
 
54
65
  - 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.
56
66
 
57
67
  ## TODO
58
68
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.0
1
+ 1.4.1
data/bin/i2cssh CHANGED
@@ -3,7 +3,7 @@ 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
8
 
9
9
  i2_options, ssh_options, servers, clusters, login_from_cli = {}, [], [], {}, false
@@ -28,7 +28,7 @@ if File.exists?(config_file)
28
28
  end
29
29
 
30
30
  optparse = OptionParser.new do |opts|
31
- opts.banner = "Usage: #{File.basename(__FILE__)} [options]"
31
+ opts.banner = "Usage: #{File.basename(__FILE__)} [options] [username@host [username@host]]"
32
32
 
33
33
  # Check if we have a cluster.
34
34
  opts.on '-c', '--cluster CLUSTERNAME',
@@ -48,6 +48,10 @@ optparse = OptionParser.new do |opts|
48
48
  i2_options[:login_override] = login_from_cli if login_from_cli
49
49
  i2_options[:broadcast] = cluster["broadcast"] || i2_options[:broadcast]
50
50
 
51
+ if i2_options[:login_override] then
52
+ cluster_hosts = cluster_hosts.map{|h| "#{i2_options[:login_override]}@#{h}"}
53
+ end
54
+
51
55
  servers += cluster_hosts
52
56
  else
53
57
  puts "ERROR: unknown cluster #{c}"
@@ -58,13 +62,7 @@ optparse = OptionParser.new do |opts|
58
62
 
59
63
  opts.on '-m', '--machines a,b,c', Array,
60
64
  '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
65
+ servers += h
68
66
  end
69
67
 
70
68
  # Hosts
@@ -126,8 +124,12 @@ optparse = OptionParser.new do |opts|
126
124
  end
127
125
  optparse.parse!
128
126
 
127
+ if ARGV.length > 0 then
128
+ servers = ARGV
129
+ end
130
+
129
131
  if i2_options[:login_override] then
130
- ssh_options << "-l #{i2_options[:login_override]}"
132
+ servers = servers.map{|h| "#{i2_options[:login_override]}@#{h.gsub(/.+@/,'')}"}
131
133
  end
132
134
 
133
135
  if servers.empty?
data/i2cssh.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "i2cssh"
8
- s.version = "1.4.0"
8
+ s.version = "1.4.1"
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"]
data/lib/i2cssh.rb CHANGED
@@ -81,7 +81,7 @@ class I2Cssh
81
81
  else
82
82
 
83
83
  @term.sessions[i].write :text => "unset HISTFILE && echo -e \"\\033]50;SetProfile=#{@profile}\\a\""
84
- sleep 0.2
84
+ sleep 0.3
85
85
  @term.sessions[i].foreground_color.set "red"
86
86
  @term.sessions[i].write :text => "stty -isig -icanon -echo && echo -e '#{"\n"*100}UNUSED' && cat > /dev/null"
87
87
  end
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: 7
4
+ hash: 5
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 4
9
- - 0
10
- version: 1.4.0
9
+ - 1
10
+ version: 1.4.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Wouter de Bie