hotdog 0.1.6 → 0.1.7

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c5f4c5c3e2ce98b90bfd87374b07db36fc8b077f
4
- data.tar.gz: be06e73ed9e26efe4e4613ab16f4192b3eae65c6
3
+ metadata.gz: be590bcf10423710cc9b86db34d0aaec800d9eaf
4
+ data.tar.gz: fb1eaa5dd9f40e4ff4889f378e1093a647e0cb90
5
5
  SHA512:
6
- metadata.gz: f0c733531b4b53e213528585429afd2c70ab20088e0740ae61bbca70e7a0306613fa1b6257a816980b180148ef8850e14d0ee9c6cace0b38395c05ddf84e5f5b
7
- data.tar.gz: 1c3bdbc7e80deed263273903924bd0c03ad187b02aa87cb9c17b860ef421c7e367466379e428afdb95fc6eff9d39e3481a406c0e8bbe55d96b79ebb9935701f6
6
+ metadata.gz: 75e2e9648fb2229292f79d70c4609ea7340637891b2a5c5db3cc637cf9e9a420f27dd2c940996cfd4ae2c22b638c2fbedf628a526e55efad474068e7ad34b5ff
7
+ data.tar.gz: 055408cd88e6f4bc745dd6ed56008107bad40a3bc7db6e8bab7698c0b2278a3b6ebb52b19546871ae05c1f2169fc8f6b72ccd5357d89cd37c6383e463b760322
@@ -13,7 +13,9 @@ module Hotdog
13
13
  index: nil,
14
14
  options: [],
15
15
  user: nil,
16
+ port: nil,
16
17
  identity_file: nil,
18
+ forward_agent: false,
17
19
  }
18
20
 
19
21
  optparse.on("-n", "--index INDEX", "Use this index of host if multiple servers are found", Integer) do |index|
@@ -25,12 +27,19 @@ module Hotdog
25
27
  optparse.on("-i SSH_IDENTITY_FILE", "SSH identity file path") do |path|
26
28
  ssh_option[:identity_file] = path
27
29
  end
30
+ optparse.on("-A", "Enable agent forwarding", TrueClass) do |b|
31
+ ssh_option[:forward_agent] = b
32
+ end
33
+ optparse.on("-p PORT", "Port of the remote host", Integer) do |port|
34
+ ssh_option[:port] = port
35
+ end
28
36
  optparse.on("-u SSH_USER", "SSH login user name") do |user|
29
37
  ssh_option[:user] = user
30
38
  end
31
39
 
32
- args = optparse.parse(args)
33
- expression = args.join(" ").strip
40
+ search_args = []
41
+ optparse.order!(args) {|search_arg| search_args.push(search_arg) }
42
+ expression = search_args.join(" ").strip
34
43
  if expression.empty?
35
44
  exit(1)
36
45
  end
@@ -47,7 +56,7 @@ module Hotdog
47
56
  if result.length == 1
48
57
  host = result[0]
49
58
  elsif result.empty?
50
- STDERR.puts("no match found: #{args.join(" ")}")
59
+ STDERR.puts("no match found: #{search_args.join(" ")}")
51
60
  exit(1)
52
61
  else
53
62
  if ssh_option[:index] && result.length > ssh_option[:index]
@@ -76,13 +85,20 @@ module Hotdog
76
85
  if path = ssh_option[:identity_file]
77
86
  cmdline << "-i" << Shellwords.escape(path)
78
87
  end
88
+ if port = ssh_option[:port]
89
+ cmdline << "-p" << port.to_s
90
+ end
91
+ if ssh_option[:forward_agent]
92
+ cmdline << "-A"
93
+ end
79
94
  if user = ssh_option[:user]
80
- cmdline << (Shellwords.escape(user) + "@" + address)
95
+ cmdline << (user + "@" + address)
81
96
  else
82
97
  cmdline << address
83
98
  end
99
+ cmdline.concat(args)
84
100
 
85
- exec cmdline.join(" ")
101
+ exec *cmdline
86
102
  exit(127)
87
103
  end
88
104
  end
@@ -1,3 +1,3 @@
1
1
  module Hotdog
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hotdog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yamashita Yuu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-03 00:00:00.000000000 Z
11
+ date: 2015-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler