polyssh 0.1.0 → 0.1.1
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 +4 -4
- data/TODO.md +6 -0
- data/bin/polyssh +1 -1
- data/lib/polyssh/cli.rb +38 -8
- data/lib/polyssh/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ad8c26d2952aaaad0545242abc43ef112a8e534
|
4
|
+
data.tar.gz: 42d8aa4d04b0fe54b61839e899e24b23cf86ec30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e366247745b56955f8ae6ec85c0b584b47756bc5f4d315da759536956d4d717b60854670423f130e19bdd0992906d052e40ef80b1dd3449483a3091fbab9a06d
|
7
|
+
data.tar.gz: 275fe0343cd0c2bb5d18c29ebfc092a0d26a181efe41dff44ce01fd62bb7dfdfe1d7371ab4c0979e5cd131e62088c62f9535aed18326e8dd876d9e6c18a01c25
|
data/TODO.md
ADDED
data/bin/polyssh
CHANGED
data/lib/polyssh/cli.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
|
2
2
|
require 'net/ssh'
|
3
3
|
require 'net/scp'
|
4
|
+
require 'optparse'
|
4
5
|
|
5
6
|
module PolySSH
|
6
7
|
class Cli
|
@@ -18,16 +19,31 @@ module PolySSH
|
|
18
19
|
|
19
20
|
def initialize
|
20
21
|
@chain = NodeList.new
|
22
|
+
@options = {}
|
21
23
|
end
|
22
24
|
|
23
25
|
def parse_cmdline args
|
26
|
+
_parse_cmdline_options args
|
27
|
+
_parse_cmdline_hops args
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
def build_commands chain
|
33
|
+
commands = chain.accept(CommandBuilder.new)
|
34
|
+
return commands
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def _parse_cmdline_hops args
|
40
|
+
puts args
|
24
41
|
args_current = []
|
25
42
|
args.each do |arg|
|
26
|
-
|
43
|
+
case arg
|
44
|
+
when /^-/
|
27
45
|
args_current << arg
|
28
|
-
|
29
|
-
# ssh_options = Net::SSH::Config.for($3)
|
30
|
-
# pp ssh_options
|
46
|
+
when /^((.+)@)?([^:]+):?(\d+)?$/
|
31
47
|
node_new = NodeEntry.new(
|
32
48
|
user: $2,
|
33
49
|
host: $3,
|
@@ -36,7 +52,6 @@ module PolySSH
|
|
36
52
|
)
|
37
53
|
@chain << node_new
|
38
54
|
args_current = []
|
39
|
-
|
40
55
|
else
|
41
56
|
STDERR.puts "ERROR: Unexpected argument #{arg}"
|
42
57
|
exit 1
|
@@ -45,10 +60,25 @@ module PolySSH
|
|
45
60
|
return @chain
|
46
61
|
end
|
47
62
|
|
63
|
+
def _parse_cmdline_options args
|
64
|
+
OptionParser.new do |opts|
|
65
|
+
opts.banner = "Usage: example.rb [options]"
|
48
66
|
|
49
|
-
|
50
|
-
|
51
|
-
|
67
|
+
opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
|
68
|
+
@options[:verbose] = v
|
69
|
+
end
|
70
|
+
opts.on("-h", "--help", "Prints this help") do
|
71
|
+
puts opts
|
72
|
+
exit
|
73
|
+
end
|
74
|
+
|
75
|
+
opts.on("--", "--", "Close #{$0} options (other options will pass to ssh)") do |v|
|
76
|
+
raise FinalOption
|
77
|
+
end
|
78
|
+
end.parse! args
|
79
|
+
rescue FinalOption
|
80
|
+
ensure
|
81
|
+
return nil
|
52
82
|
end
|
53
83
|
end #class
|
54
84
|
end #module
|
data/lib/polyssh/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: polyssh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Glenn Y. Rolland
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-scp
|
@@ -94,6 +94,7 @@ files:
|
|
94
94
|
- LICENSE.txt
|
95
95
|
- README.md
|
96
96
|
- Rakefile
|
97
|
+
- TODO.md
|
97
98
|
- bin/polyssh
|
98
99
|
- lib/polyssh.rb
|
99
100
|
- lib/polyssh/cli.rb
|