net-ssh-cli 1.6.0 → 1.7.0
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/.ruby-version +1 -1
- data/README.md +23 -0
- data/lib/net/ssh/cli.rb +2 -1
- data/lib/net/ssh/cli/version.rb +1 -1
- data/net-ssh-cli.gemspec +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6dd5a361663ac8c45079e1833688679c699f0022c1aa222f5e315992b2457fa3
|
4
|
+
data.tar.gz: d10d53f383ea82e100ff38ca46978fb27fbbaec1f49a8e6c4cd0e8cbca7abf9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ab1b89f32f27604f5c04ed43b262f69860884be324077acc5802b5d0b03ebb544818ea53e36a8c04077a00a47b8e320aa7ae664653fd6eddeb3f6d53f0e30b9
|
7
|
+
data.tar.gz: 99bd97c5b61ea4853a3150047f8b88d6165e00a8e343b1a3ca746fd8648915555edcdc9bcbe0277568cf8d822e7622bdaa3a457604a7956bf9797d73a32eeef4
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.0
|
data/README.md
CHANGED
@@ -162,6 +162,8 @@ The following callbacks are available
|
|
162
162
|
- after_open_channel
|
163
163
|
- before_on_stdout
|
164
164
|
- after_on_stdout
|
165
|
+
- before_on_stdin
|
166
|
+
- after_on_stdin
|
165
167
|
|
166
168
|
```ruby
|
167
169
|
cli.before_open_channel do
|
@@ -184,12 +186,33 @@ cli.after_on_stdout do
|
|
184
186
|
end
|
185
187
|
```
|
186
188
|
|
189
|
+
```ruby
|
190
|
+
cli.after_on_stdout do
|
191
|
+
puts "the following new data arrived on stdout #{new_data.inspect} from #{hostname}"
|
192
|
+
end
|
193
|
+
```
|
194
|
+
|
195
|
+
or convert new lines between different OS
|
187
196
|
```ruby
|
188
197
|
cli.after_on_stdout do
|
189
198
|
stdout.gsub!("\r\n", "\n")
|
190
199
|
end
|
191
200
|
```
|
192
201
|
|
202
|
+
or hide passwords
|
203
|
+
```ruby
|
204
|
+
cli.after_on_stdout do
|
205
|
+
stdout.gsub!(/password:\S+/, "<HIDDEN>")
|
206
|
+
end
|
207
|
+
```
|
208
|
+
|
209
|
+
or change the stdin before sending it
|
210
|
+
```ruby
|
211
|
+
cli.before_on_stdin do
|
212
|
+
content.gsub("\n\n", "\n")
|
213
|
+
end
|
214
|
+
```
|
215
|
+
|
193
216
|
### #hostname #host #to_s
|
194
217
|
|
195
218
|
```ruby
|
data/lib/net/ssh/cli.rb
CHANGED
@@ -43,6 +43,7 @@ module Net
|
|
43
43
|
default_prompt: /\n?^(\S+@.*)\z/, # the default prompt to search for
|
44
44
|
cmd_rm_prompt: false, # whether the prompt should be removed in the output of #cmd
|
45
45
|
cmd_rm_command: false, # whether the given command should be removed in the output of #cmd
|
46
|
+
cmd_rm_command_tail: "\n", # which format does the end of line return after a command has been submitted. Could be something like "ls\n" "ls\r\n" or "ls \n" (extra spaces)
|
46
47
|
run_impact: false, # whether to run #impact commands. This might align with testing|development|production. example #impact("reboot")
|
47
48
|
read_till_timeout: nil, # timeout for #read_till to find the match
|
48
49
|
read_till_hard_timeout: nil, # hard timeout for #read_till to find the match using Timeout.timeout(hard_timeout) {}. Might creates unpredicted sideffects
|
@@ -280,7 +281,7 @@ module Net
|
|
280
281
|
alias commands cmds
|
281
282
|
|
282
283
|
def rm_command!(output, command, **opts)
|
283
|
-
output[command +
|
284
|
+
output[command + cmd_rm_command_tail] = '' if rm_command?(**opts) && output[command + cmd_rm_command_tail]
|
284
285
|
end
|
285
286
|
|
286
287
|
# removes the prompt from the given output
|
data/lib/net/ssh/cli/version.rb
CHANGED
data/net-ssh-cli.gemspec
CHANGED
@@ -39,7 +39,7 @@ Gem::Specification.new do |spec|
|
|
39
39
|
|
40
40
|
spec.add_development_dependency 'bundler'
|
41
41
|
spec.add_development_dependency 'bump'
|
42
|
-
spec.add_development_dependency 'rake', '~>
|
42
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
43
43
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
44
44
|
spec.add_dependency 'activesupport', '>= 4.0'
|
45
45
|
spec.add_dependency 'net-ssh', '>= 4.0'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: net-ssh-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fabian Stillhart
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '13.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '13.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -140,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
140
|
- !ruby/object:Gem::Version
|
141
141
|
version: '0'
|
142
142
|
requirements: []
|
143
|
-
rubygems_version: 3.
|
143
|
+
rubygems_version: 3.2.3
|
144
144
|
signing_key:
|
145
145
|
specification_version: 4
|
146
146
|
summary: 'Net::SSH::CLI: A library to handle CLI Sessions'
|