ssh-short 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/lib/ssh_short/cli.rb +4 -0
- data/lib/ssh_short/parser.rb +2 -5
- data/lib/ssh_short/version.rb +1 -1
- data/spec/ssh_short/parser_spec.rb +2 -14
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA512:
|
3
|
-
|
4
|
-
|
3
|
+
metadata.gz: bbe973b7717c28b471aabdc48d745b426a06ca643b5e73917718d3a82e56fb21b80a4ac4c673777cf43c06889b029e56ea3d44fe778ae6a15e0850666c3471ac
|
4
|
+
data.tar.gz: 76944a2e2c54ec68e1ce484fe8aea6dc45ed5e46267a5d4ce7f8e339345b1456ab0e31f2f8e7e5e8bb4cbba0292bc491553d04181a9ea296207e45b56cb2852c
|
5
5
|
SHA1:
|
6
|
-
|
7
|
-
|
6
|
+
metadata.gz: 20e9987e3c98a5143b9e66939a19eab801e22e7d
|
7
|
+
data.tar.gz: f7e8835fb92e1f2f930755a26b2eaec005e1f4b3
|
data/lib/ssh_short/cli.rb
CHANGED
@@ -29,6 +29,10 @@ module SshShort
|
|
29
29
|
if node[:key].nil? or args[:force_key_prompt]
|
30
30
|
node[:key] = key_set.prompt_for_key
|
31
31
|
end
|
32
|
+
if node[:user].nil?
|
33
|
+
abort 'No user was provided and no default is set' unless config[:default_user]
|
34
|
+
node[:user] = config[:default_user]
|
35
|
+
end
|
32
36
|
node = CLI.add_options_if_present(node, args, [:alias, :user])
|
33
37
|
|
34
38
|
node_mapper.update_node(node)
|
data/lib/ssh_short/parser.rb
CHANGED
@@ -18,7 +18,7 @@ module SshShort
|
|
18
18
|
options = self.key_options args, {}
|
19
19
|
options = self.alias_option args, options
|
20
20
|
options = self.action_options args, options
|
21
|
-
options = self.user_options args, options
|
21
|
+
options = self.user_options args, options
|
22
22
|
options = self.node_options args, options, config[:ip_mask]
|
23
23
|
options
|
24
24
|
end
|
@@ -40,14 +40,11 @@ module SshShort
|
|
40
40
|
options
|
41
41
|
end
|
42
42
|
|
43
|
-
def self.user_options(args, options
|
43
|
+
def self.user_options(args, options)
|
44
44
|
user_index = args.index('-u')
|
45
45
|
if user_index
|
46
46
|
options[:user] = args[user_index + 1]
|
47
47
|
2.times { args.delete_at user_index }
|
48
|
-
else
|
49
|
-
abort 'No user was provided and no default is set' unless default_user
|
50
|
-
options[:user] = default_user
|
51
48
|
end
|
52
49
|
options
|
53
50
|
end
|
data/lib/ssh_short/version.rb
CHANGED
@@ -91,23 +91,11 @@ describe SshShort::Parser do
|
|
91
91
|
|
92
92
|
context 'when no user is provided' do
|
93
93
|
|
94
|
-
it '
|
94
|
+
it 'leaves the user unset' do
|
95
95
|
options = SshShort::Parser.parse_input(config, standard_args)
|
96
|
-
expect(options
|
96
|
+
expect(options).to_not include(:user)
|
97
97
|
end
|
98
98
|
|
99
|
-
context 'and when config user is null' do
|
100
|
-
|
101
|
-
let(:no_user_config) { config.delete_if{|k, v| k == :default_user} }
|
102
|
-
|
103
|
-
it 'aborts with error message' do
|
104
|
-
expect {
|
105
|
-
expect {
|
106
|
-
SshShort::Parser.parse_input(no_user_config, standard_args)
|
107
|
-
}.to raise_error SystemExit
|
108
|
-
}.to output(/No user was provided/).to_stderr
|
109
|
-
end
|
110
|
-
end
|
111
99
|
end
|
112
100
|
|
113
101
|
context 'when a user is provided' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ssh-short
|
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
|
- Tom Poulton
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2015-09-
|
12
|
+
date: 2015-09-25 00:00:00 Z
|
13
13
|
dependencies: []
|
14
14
|
|
15
15
|
description: Easy ssh
|