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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cff4e8939d9e01ad6748d5bf6d5a8b3ba04f5317
4
- data.tar.gz: 1b2888b7bccfdef7b0f95aa631f032127dae99c3
3
+ metadata.gz: 2ad8c26d2952aaaad0545242abc43ef112a8e534
4
+ data.tar.gz: 42d8aa4d04b0fe54b61839e899e24b23cf86ec30
5
5
  SHA512:
6
- metadata.gz: 8c8f9d54fca3c5803a4b4e9a93ff8528a934a2fc995975da09fb3181854bda8a15f980c50be1903171e68e15ccb7493b81647d11c9eb8a4f23bef41b0c94f27c
7
- data.tar.gz: 47522e72ebb4ee588da407a26aa4b3efa5b533eb1c5424fbd20e76cfddc3a972764e96fcdcb8fd2fc3cbd45a29545784a1e9ed20fbfd20919fdf9730d4b5f1e9
6
+ metadata.gz: e366247745b56955f8ae6ec85c0b584b47756bc5f4d315da759536956d4d717b60854670423f130e19bdd0992906d052e40ef80b1dd3449483a3091fbab9a06d
7
+ data.tar.gz: 275fe0343cd0c2bb5d18c29ebfc092a0d26a181efe41dff44ce01fd62bb7dfdfe1d7371ab4c0979e5cd131e62088c62f9535aed18326e8dd876d9e6c18a01c25
data/TODO.md ADDED
@@ -0,0 +1,6 @@
1
+ # TODO
2
+
3
+ ## Detect local ssh options with
4
+
5
+ ssh_options = Net::SSH::Config.for($3)
6
+ pp ssh_options
data/bin/polyssh CHANGED
@@ -2,7 +2,7 @@
2
2
  # vim: set ts=2 sw=2 et:
3
3
 
4
4
  require 'polyssh'
5
- # require 'pp'
5
+ require 'pp'
6
6
 
7
7
  PolySSH::Cli.start(ARGV)
8
8
 
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
- if arg =~ /^-/ then
43
+ case arg
44
+ when /^-/
27
45
  args_current << arg
28
- elsif arg =~ /^((.+)@)?([^:]+):?(\d+)?$/ then
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
- def build_commands chain
50
- commands = chain.accept(CommandBuilder.new)
51
- return commands
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
@@ -1,3 +1,3 @@
1
1
  module PolySSH
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
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.0
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-03 00:00:00.000000000 Z
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