giterm 2.0.2 → 2.0.3

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 (3) hide show
  1. checksums.yaml +4 -4
  2. data/giterm +40 -17
  3. metadata +4 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ff35951790433a2f8aee112a5f1da5753a64076def68327e1a2cf02bd99c0e18
4
- data.tar.gz: fc8c53303b5b678b21e99b6312f3d93587f83ddb0c809dc51069f9c0b16bc883
3
+ metadata.gz: 2a819be71e11539fa2d3745023e362f954b1dca51aaea25ad4af4c1636ef7d50
4
+ data.tar.gz: f5a4aa8801cf06cddf6f3b75ef19b0fac8b755537fe5402772353e3e98174b7f
5
5
  SHA512:
6
- metadata.gz: b4a1045fe19fbafe0f26a99a0da543d6c0c723d49189ac76fae28c941cd6c357bd8929c1a1e3b6b6f561f58d7fcf6129c82093b6be952467addf6759a8b7ff10
7
- data.tar.gz: 333992ec11e581dd6821430a30250c32113a58480bb752bb81988296cf9578840e9940be8041e393a39ae1c83403e2ef91cfa37db14855b1b01d8d4354b25211
6
+ metadata.gz: 18f086fa4d30035af2c9c2264488ca02dcb247b159f67c84acf8978ac6f8268276d590dfa447b1521c90b7e6d0380b0df6a03faff3778306b99be73a7258159a
7
+ data.tar.gz: e79072c30b13faee5e19096c93aba231163f52259cf055ac027422aaf240983204a95529d77a10031d4bc54075e45709957da4644b1e3ac9b71631018d888407
data/giterm CHANGED
@@ -7,7 +7,7 @@
7
7
  # Author: Geir Isene <g@isene.com> (adapted from RTFM)
8
8
  # Github: https://github.com/isene/GiTerm
9
9
  # License: Public domain
10
- @version = '2.0.1'
10
+ @version = '2.0.3'
11
11
 
12
12
  # SAVE & STORE TERMINAL {{{1
13
13
  ORIG_STTY = `stty -g 2>/dev/null`.chomp rescue ''
@@ -1225,17 +1225,40 @@ rescue => e
1225
1225
  log_debug("Error in extended fetch: #{e.message}")
1226
1226
  end
1227
1227
 
1228
+ def filter_markdown_clutter(text)
1229
+ # Remove badge markdown (both simple and nested)
1230
+ # Matches: ![text](url) and [![text](url)](link)
1231
+ text = text.gsub(/!\[(?:[^\]]*\[[^\]]*\][^\]]*|[^\]]*)\]\([^\)]+\)/, '')
1232
+
1233
+ # Remove HTML image tags
1234
+ text = text.gsub(/<img[^>]*>/, '')
1235
+
1236
+ # Remove HTML break tags
1237
+ text = text.gsub(/<br[^>]*>/, '')
1238
+
1239
+ # Remove lines that are only badges/links (leftover clutter)
1240
+ text = text.lines.reject { |line| line.strip.match?(/^[\[\]():\/.a-zA-Z0-9_-]+$/) && line.include?('](') }.join
1241
+
1242
+ # Remove excessive blank lines (more than 2 consecutive)
1243
+ text = text.gsub(/\n{3,}/, "\n\n")
1244
+
1245
+ # Remove lines that are only whitespace
1246
+ text = text.lines.reject { |line| line.strip.empty? && line != "\n" }.join
1247
+
1248
+ text.strip
1249
+ end
1250
+
1228
1251
  def fetch_readme(repo_full_name)
1229
1252
  return nil unless repo_full_name
1230
-
1253
+
1231
1254
  # Try different README variations
1232
1255
  readme_files = ['README.md', 'readme.md', 'README.txt', 'README', 'readme.txt']
1233
-
1256
+
1234
1257
  readme_files.each do |filename|
1235
1258
  begin
1236
1259
  result = github_request("/repos/#{repo_full_name}/contents/#{filename}")
1237
1260
  next if result.is_a?(Hash) && result[:error]
1238
-
1261
+
1239
1262
  # Decode base64 content
1240
1263
  if result.is_a?(Hash) && result['content'] && result['encoding'] == 'base64'
1241
1264
  decoded = Base64.decode64(result['content'].gsub(/\s/, ''))
@@ -1244,15 +1267,16 @@ def fetch_readme(repo_full_name)
1244
1267
  unless decoded.valid_encoding?
1245
1268
  decoded = decoded.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '?')
1246
1269
  end
1247
- # Limit README display to avoid overwhelming the pane
1248
- return decoded.lines.first(20).join.strip
1270
+ # Filter markdown clutter and limit README display
1271
+ filtered = filter_markdown_clutter(decoded)
1272
+ return filtered.lines.first(20).join.strip
1249
1273
  end
1250
1274
  rescue => e
1251
1275
  log_debug("Error fetching README #{filename}: #{e.message}")
1252
1276
  next
1253
1277
  end
1254
1278
  end
1255
-
1279
+
1256
1280
  nil
1257
1281
  end
1258
1282
 
@@ -1282,20 +1306,19 @@ def fetch_repo_files(repo_full_name, path = '')
1282
1306
  # Show directories first, then files
1283
1307
  (dirs + files).each do |item|
1284
1308
  icon = case item['type']
1285
- when 'dir' then '📁'
1309
+ when 'dir' then ''
1286
1310
  when 'file'
1287
1311
  case File.extname(item['name']).downcase
1288
- when '.md' then '📄'
1289
- when '.rb' then '💎'
1290
- when '.py' then '🐍'
1291
- when '.js' then '📜'
1292
- when '.json' then '⚙️'
1293
- when '.yml', '.yaml' then '⚙️'
1294
- else '📄'
1312
+ when '.md' then ''
1313
+ when '.rb' then ''
1314
+ when '.py' then ''
1315
+ when '.js' then ''
1316
+ when '.json', '.yml', '.yaml' then ''
1317
+ else ''
1295
1318
  end
1296
- else ''
1319
+ else '?'
1297
1320
  end
1298
-
1321
+
1299
1322
  size_info = item['size'] ? " (#{format_file_size(item['size'])})" : ""
1300
1323
  content += "#{icon} #{item['name']}#{size_info}\n"
1301
1324
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: giterm
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geir Isene
8
8
  autorequire:
9
9
  bindir: "."
10
10
  cert_chain: []
11
- date: 2025-08-19 00:00:00.000000000 Z
11
+ date: 2025-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rcurses
@@ -54,7 +54,8 @@ dependencies:
54
54
  version: '13.0'
55
55
  description: 'GiTerm is a powerful terminal interface for Git and GitHub, providing
56
56
  an intuitive TUI for repository management, issue tracking, and pull request handling.
57
- Version 2.0.2: Fixed macOS branch selection and commit diff display issues.'
57
+ Version 2.0.3: Improved README display with markdown filtering and urxvt-compatible
58
+ symbols.'
58
59
  email:
59
60
  - g@isene.com
60
61
  executables: