ssh_tunnels 0.4.1 → 0.4.2

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
  SHA256:
3
- metadata.gz: 79e3f82e75a37a3fd7ca199dc827a217d33c91be2b5f1fc65c445e583d14d82c
4
- data.tar.gz: b08d3849be1742e6581dcdf23e9c65f4cfc3c048d396bf877227e1bc2aa9f177
3
+ metadata.gz: 7bbbe0e2381585ad9d8035fd023bb2417bcac0f26c2a14afb3447186840b0fb3
4
+ data.tar.gz: 8fdf3c1c6d59dd7a26d4b5a6eb5214b9092acae1b01ad455938606aa5f8d303c
5
5
  SHA512:
6
- metadata.gz: 8d03a2c30f5e5d341513f0c24dd4d0efbf482b6cce2339dd41fdf128bdf28f9b53c0674afed04dae6de5899a803def7e28c25f0bd7f24d43cead291eab06348c
7
- data.tar.gz: 87ed978f47c22b43cc27a9fe182ab86d9b30d070cea090eddf5940f37a59bf1ecbf473579c509b01ea140550d07b3ae325a38525106956476f7ce5665576a912
6
+ metadata.gz: 15fc0aa0bc8331899e0db46f07b2fd714947f759f020c4c2ca66e4c5179b9a74368c774635fdd933707dfa9fe054b0900a7ac92690e57d69a85aa329fadfa28b
7
+ data.tar.gz: 4a9db83822c7538422e6952df1fececfde9381bada0159c6317312c173682b4576ecb602b14ce69df91fb70818a72a7c566bbfceee09626276ee99f46da691db
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ssh_tunnels (0.4.1)
4
+ ssh_tunnels (0.4.2)
5
5
  bcrypt_pbkdf (~> 1.1)
6
6
  curses (~> 1.4)
7
7
  ed25519 (~> 1.3)
data/README.md CHANGED
@@ -117,6 +117,10 @@ The configuration file is checked once a second while the app is running. Saving
117
117
 
118
118
  Anything written to the standard error stream while the app is running (a backtrace from a failed connection, for example) is captured and shown below the tunnel list. Press `Esc` to clear it. Only the most recent output is kept.
119
119
 
120
+ ## Redrawing the screen
121
+
122
+ Press `Esc` (or `Ctrl-L`) to clear and redraw the screen if stray characters appear. `Esc` also clears any error output. The screen is redrawn automatically when the terminal is resized.
123
+
120
124
  ## Contributing
121
125
 
122
126
  Pull requests are welcome.
@@ -14,6 +14,7 @@ module SshTunnels
14
14
  yellow: Curses::COLOR_YELLOW
15
15
  }.freeze
16
16
  ESCAPE = [27, "\e"].freeze
17
+ REDRAW = [12, "\f", Curses::KEY_RESIZE].freeze
17
18
 
18
19
  def initialize(config, user, passphrase)
19
20
  @config = config
@@ -150,9 +151,9 @@ module SshTunnels
150
151
  end
151
152
 
152
153
  def usage_message
153
- return "No tunnels configured. Press 'q' to quit." if @tunnels.empty?
154
+ return "No tunnels configured. Esc to redraw. Press 'q' to quit." if @tunnels.empty?
154
155
 
155
- "[1-#{IDENTIFIERS[@tunnels.size - 1]}] to connect/disconnect. Press 'q' to quit."
156
+ "[1-#{IDENTIFIERS[@tunnels.size - 1]}] to connect/disconnect. Esc to redraw. Press 'q' to quit."
156
157
  end
157
158
 
158
159
  # Output captured from the standard error stream (a backtrace, usually) is
@@ -190,8 +191,7 @@ module SshTunnels
190
191
  end
191
192
 
192
193
  def process_input(input)
193
- raise UserQuit if input == 'q'
194
- return @stderr_capture.clear if ESCAPE.include?(input)
194
+ return if command?(input)
195
195
  return status("Unrecognized input: #{input}") unless input.is_a?(String) && input =~ /\A[0-9a-zA-Z]\Z/
196
196
 
197
197
  index = IDENTIFIERS.index(input)
@@ -201,6 +201,29 @@ module SshTunnels
201
201
  toggle_tunnel(tunnel)
202
202
  end
203
203
 
204
+ # Handles keys that are not tunnel identifiers. Returns true if handled.
205
+ def command?(input)
206
+ raise UserQuit if input == 'q'
207
+
208
+ if ESCAPE.include?(input)
209
+ @stderr_capture.clear
210
+ redraw
211
+ elsif REDRAW.include?(input)
212
+ redraw
213
+ else
214
+ return false
215
+ end
216
+ true
217
+ end
218
+
219
+ # Clearing the window makes the next refresh repaint the whole terminal,
220
+ # removing stray characters left behind by a resize or by output written
221
+ # directly to the terminal. The next loop iteration draws everything again.
222
+ def redraw
223
+ window.clear
224
+ @status_time = nil
225
+ end
226
+
204
227
  def toggle_tunnel(tunnel)
205
228
  status("#{tunnel.active? ? 'Disconnecting' : 'Connecting'}: #{tunnel}")
206
229
  tunnel.toggle
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SshTunnels
4
- VERSION = '0.4.1'
4
+ VERSION = '0.4.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ssh_tunnels
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bob Farrell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-11-23 00:00:00.000000000 Z
11
+ date: 2026-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bcrypt_pbkdf