betters3tui 0.2.5 → 0.2.6

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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +10 -0
  3. data/lib/betters3tui.rb +75 -4
  4. data/lib/fuzzy.rb +1 -1
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a38bace5feab978c53307d83130bb1846a52c9b024b1588cb87105ed1f3528e6
4
- data.tar.gz: e85a7aab711a451329a9c6f8f7605b0d61a29bafdaab2c730f993580b1501dcb
3
+ metadata.gz: ab931099fefd059f96432438693cbdcdeeb8f787ddf0b747b0803381f2633e46
4
+ data.tar.gz: 50f83a05203e7f4fb2b1c70948c0c57be51263616b515b74baff606b89f92283
5
5
  SHA512:
6
- metadata.gz: b547d135fa3ee99704d329013bacb11106b1c01162e984072c97923016ebf238a01c3b669fa2d79562f22b18d22c74f0e68020d640315435ffb2dc1c5b7dc9bc
7
- data.tar.gz: '0950b85f3a174d694b9291790ccf2ce570326eae8faf0ed7d8e951d0efdc4edbfedfaeff651932a725ed2ad19e4ef1d820371b1a4f3c085513093f8190c2948d'
6
+ metadata.gz: a3ec6adc6791f0c8de899381721af78cbb6c42886345f25c0957cbde1fee4bf6bd8bbcc87caee4ccf5952ba006d61116bf3373a8c9fad9d1698b6d3bd6e4f2c2
7
+ data.tar.gz: 9dafee1ec69e01d8bf5862a5291a85c50b1a2dff499477b7497949c5e96d58ba806375b852d4a2e7110065efa91cc53c8db49b395df067761ceb3114345e0403
data/CHANGELOG.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [0.2.6] - 2026-02-27
6
+
7
+ ### Added
8
+ - **Download progress bar** - Visual progress indicator when downloading files with percentage, file size, and completion status
9
+ - **Loading indicators** - Show "Loading buckets..." and "Loading directory contents..." when fetching data from S3
10
+
11
+ ### Fixed
12
+ - **Ruby compatibility** - Fixed `Data.define` error for Ruby versions < 3.2 by using `Struct` instead
13
+
5
14
  ## [0.1.1] - 2026-02-27
6
15
 
7
16
  ### Added
@@ -25,5 +34,6 @@ All notable changes to this project will be documented in this file.
25
34
  - File download capability
26
35
  - Interactive keyboard navigation
27
36
 
37
+ [0.2.6]: https://github.com/adiprnm/betters3tui/compare/v0.2.5...v0.2.6
28
38
  [0.1.1]: https://github.com/adiprnm/betters3tui/compare/v0.1.0...v0.1.1
29
39
  [0.1.0]: https://github.com/adiprnm/betters3tui/releases/tag/v0.1.0
data/lib/betters3tui.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- VERSION = "0.2.5"
4
+ VERSION = "0.2.6"
5
5
 
6
6
  require "json"
7
7
  require "aws-sdk-s3"
@@ -62,6 +62,10 @@ class S3Browser
62
62
  { key: 'd', label: 'Date', value: :date }
63
63
  ]
64
64
  @sort_menu_index = 0
65
+
66
+ # Loading state
67
+ @loading = false
68
+ @loading_message = ""
65
69
  end
66
70
 
67
71
  def run
@@ -172,7 +176,23 @@ class S3Browser
172
176
  line.right.write_dim(node_count_text)
173
177
  end
174
178
 
175
- if @message && Time.now - @message_time < 3
179
+ if @loading
180
+ screen.footer.add_line do |line|
181
+ line.write << Tui::Text.highlight(@loading_message)
182
+ end
183
+ elsif @downloading && @download_progress
184
+ progress = @download_progress
185
+ percent = (progress[:downloaded].to_f / progress[:total] * 100).round(1)
186
+ bar_width = 20
187
+ filled = (percent / 100 * bar_width).to_i
188
+ bar = "█" * filled + "░" * (bar_width - filled)
189
+ downloaded_str = format_size(progress[:downloaded])
190
+ total_str = format_size(progress[:total])
191
+ progress_msg = "Downloading #{progress[:filename]}: [#{bar}] #{percent}% (#{downloaded_str}/#{total_str})"
192
+ screen.footer.add_line do |line|
193
+ line.write << Tui::Text.highlight(progress_msg)
194
+ end
195
+ elsif @message && Time.now - @message_time < 3
176
196
  screen.footer.add_line do |line|
177
197
  line.write << (@message.include?("Error") ? Tui::Text.accent(@message) : Tui::Text.highlight(@message))
178
198
  end
@@ -1164,16 +1184,27 @@ class S3Browser
1164
1184
  def list_buckets
1165
1185
  return unless @s3_client
1166
1186
 
1187
+ @loading = true
1188
+ @loading_message = "Loading buckets..."
1189
+ render
1190
+
1167
1191
  response = @s3_client.list_buckets
1168
1192
  @buckets = response.buckets
1169
1193
  rescue => e
1170
1194
  show_message("Error listing buckets: #{e.message}")
1171
1195
  @buckets = []
1196
+ ensure
1197
+ @loading = false
1172
1198
  end
1173
1199
 
1174
1200
  def list_objects
1175
1201
  return unless @s3_client && @current_bucket
1176
1202
 
1203
+ # Show loading indicator
1204
+ @loading = true
1205
+ @loading_message = "Loading directory contents..."
1206
+ render
1207
+
1177
1208
  delimiter = "/"
1178
1209
  response = @s3_client.list_objects_v2(
1179
1210
  bucket: @current_bucket,
@@ -1203,6 +1234,8 @@ class S3Browser
1203
1234
  rescue => e
1204
1235
  show_message("Error listing objects: #{e.message}")
1205
1236
  @objects = []
1237
+ ensure
1238
+ @loading = false
1206
1239
  end
1207
1240
 
1208
1241
  def download_current
@@ -1234,18 +1267,56 @@ class S3Browser
1234
1267
  counter += 1
1235
1268
  end
1236
1269
 
1270
+ @downloading = true
1237
1271
  begin
1238
- @s3_client.get_object(
1239
- response_target: download_path,
1272
+ # Get file size first
1273
+ head_response = @s3_client.head_object(
1240
1274
  bucket: @current_bucket,
1241
1275
  key: key
1242
1276
  )
1277
+ total_size = head_response.content_length
1278
+
1279
+ # Download with progress
1280
+ downloaded = 0
1281
+ File.open(download_path, 'wb') do |file|
1282
+ @s3_client.get_object(
1283
+ bucket: @current_bucket,
1284
+ key: key
1285
+ ) do |chunk|
1286
+ file.write(chunk)
1287
+ downloaded += chunk.bytesize
1288
+ @download_progress = {
1289
+ filename: filename,
1290
+ downloaded: downloaded,
1291
+ total: total_size
1292
+ }
1293
+ render
1294
+ end
1295
+ end
1243
1296
  show_message("Downloaded: #{filename}")
1244
1297
  rescue => e
1245
1298
  show_message("Error downloading: #{e.message}")
1299
+ ensure
1300
+ @downloading = false
1301
+ @download_progress = nil
1246
1302
  end
1247
1303
  end
1248
1304
 
1305
+ def show_download_progress(filename, downloaded, total)
1306
+ return if total.nil? || total == 0
1307
+
1308
+ percent = (downloaded.to_f / total * 100).round(1)
1309
+ bar_width = 20
1310
+ filled = (percent / 100 * bar_width).to_i
1311
+ bar = "█" * filled + "░" * (bar_width - filled)
1312
+
1313
+ downloaded_str = format_size(downloaded)
1314
+ total_str = format_size(total)
1315
+
1316
+ @message = "Downloading #{filename}: [#{bar}] #{percent}% (#{downloaded_str}/#{total_str})"
1317
+ @message_time = Time.now
1318
+ end
1319
+
1249
1320
  def show_message(msg)
1250
1321
  @message = msg
1251
1322
  @message_time = Time.now
data/lib/fuzzy.rb CHANGED
@@ -20,7 +20,7 @@
20
20
  # fuzzy.match("proj").limit(10).each { |entry, positions, score| ... }
21
21
  #
22
22
  class Fuzzy
23
- Entry = Data.define(:data, :text, :text_lower, :base_score)
23
+ Entry = Struct.new(:data, :text, :text_lower, :base_score, keyword_init: true)
24
24
 
25
25
  def initialize(entries)
26
26
  @entries = entries.map do |e|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: betters3tui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adi Purnama