giterm 2.0.1 → 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.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/giterm +124 -21
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2a819be71e11539fa2d3745023e362f954b1dca51aaea25ad4af4c1636ef7d50
|
|
4
|
+
data.tar.gz: f5a4aa8801cf06cddf6f3b75ef19b0fac8b755537fe5402772353e3e98174b7f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 18f086fa4d30035af2c9c2264488ca02dcb247b159f67c84acf8978ac6f8268276d590dfa447b1521c90b7e6d0380b0df6a03faff3778306b99be73a7258159a
|
|
7
|
+
data.tar.gz: e79072c30b13faee5e19096c93aba231163f52259cf055ac027422aaf240983204a95529d77a10031d4bc54075e45709957da4644b1e3ac9b71631018d888407
|
data/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# GiTerm - Git & GitHub Terminal User Interface
|
|
2
2
|
|
|
3
3
|
<img src="img/giterm_logo.svg" align="left" width="150" height="150">
|
|
4
|
+
<br clear="left"/>
|
|
4
5
|
|
|
5
6
|
[](https://unlicense.org/)
|
|
6
7
|
[](https://github.com/isene/GiTerm/stargazers)
|
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.
|
|
10
|
+
@version = '2.0.3'
|
|
11
11
|
|
|
12
12
|
# SAVE & STORE TERMINAL {{{1
|
|
13
13
|
ORIG_STTY = `stty -g 2>/dev/null`.chomp rescue ''
|
|
@@ -708,12 +708,67 @@ def display_log
|
|
|
708
708
|
end
|
|
709
709
|
|
|
710
710
|
def show_commit_details(hash)
|
|
711
|
-
|
|
711
|
+
# Show full commit with diff, not just stats
|
|
712
|
+
details = `git show #{hash} 2>/dev/null`
|
|
712
713
|
|
|
713
714
|
@p_right.clear
|
|
714
715
|
@p_right.say(details)
|
|
715
716
|
end
|
|
716
717
|
|
|
718
|
+
def show_branch_details(branch)
|
|
719
|
+
return unless branch
|
|
720
|
+
|
|
721
|
+
@p_right.clear
|
|
722
|
+
|
|
723
|
+
branch_name = branch[:name]
|
|
724
|
+
|
|
725
|
+
# Show branch information
|
|
726
|
+
info = "Branch: #{branch_name}\n\n"
|
|
727
|
+
|
|
728
|
+
if branch[:current]
|
|
729
|
+
info += "Status: Currently checked out\n\n"
|
|
730
|
+
else
|
|
731
|
+
info += "Status: Not checked out\n\n"
|
|
732
|
+
end
|
|
733
|
+
|
|
734
|
+
# Show last 10 commits on this branch
|
|
735
|
+
info += "Recent commits:\n" + '─' * 40 + "\n\n"
|
|
736
|
+
|
|
737
|
+
# Get commit log for this branch
|
|
738
|
+
if branch_name.start_with?('remotes/')
|
|
739
|
+
# For remote branches, use the full name
|
|
740
|
+
log_output = `git log --oneline -10 #{branch_name} 2>/dev/null`
|
|
741
|
+
else
|
|
742
|
+
# For local branches
|
|
743
|
+
log_output = `git log --oneline -10 #{branch_name} 2>/dev/null`
|
|
744
|
+
end
|
|
745
|
+
|
|
746
|
+
if log_output.empty?
|
|
747
|
+
info += "No commits found on this branch\n"
|
|
748
|
+
else
|
|
749
|
+
info += log_output
|
|
750
|
+
end
|
|
751
|
+
|
|
752
|
+
# Show branch tracking info if available
|
|
753
|
+
if !branch_name.start_with?('remotes/')
|
|
754
|
+
tracking = `git rev-parse --abbrev-ref #{branch_name}@{upstream} 2>/dev/null`.strip
|
|
755
|
+
unless tracking.empty?
|
|
756
|
+
info += "\n" + '─' * 40 + "\n"
|
|
757
|
+
info += "Tracking: #{tracking}\n"
|
|
758
|
+
|
|
759
|
+
# Show ahead/behind status
|
|
760
|
+
ahead_behind = `git rev-list --left-right --count #{branch_name}...#{tracking} 2>/dev/null`.strip
|
|
761
|
+
unless ahead_behind.empty?
|
|
762
|
+
ahead, behind = ahead_behind.split("\t")
|
|
763
|
+
info += "Ahead: #{ahead} commits\n" if ahead.to_i > 0
|
|
764
|
+
info += "Behind: #{behind} commits\n" if behind.to_i > 0
|
|
765
|
+
end
|
|
766
|
+
end
|
|
767
|
+
end
|
|
768
|
+
|
|
769
|
+
@p_right.say(info)
|
|
770
|
+
end
|
|
771
|
+
|
|
717
772
|
def git_branches
|
|
718
773
|
unless @is_git_repo
|
|
719
774
|
@p_left.clear
|
|
@@ -1170,17 +1225,40 @@ rescue => e
|
|
|
1170
1225
|
log_debug("Error in extended fetch: #{e.message}")
|
|
1171
1226
|
end
|
|
1172
1227
|
|
|
1228
|
+
def filter_markdown_clutter(text)
|
|
1229
|
+
# Remove badge markdown (both simple and nested)
|
|
1230
|
+
# Matches:  and [](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
|
+
|
|
1173
1251
|
def fetch_readme(repo_full_name)
|
|
1174
1252
|
return nil unless repo_full_name
|
|
1175
|
-
|
|
1253
|
+
|
|
1176
1254
|
# Try different README variations
|
|
1177
1255
|
readme_files = ['README.md', 'readme.md', 'README.txt', 'README', 'readme.txt']
|
|
1178
|
-
|
|
1256
|
+
|
|
1179
1257
|
readme_files.each do |filename|
|
|
1180
1258
|
begin
|
|
1181
1259
|
result = github_request("/repos/#{repo_full_name}/contents/#{filename}")
|
|
1182
1260
|
next if result.is_a?(Hash) && result[:error]
|
|
1183
|
-
|
|
1261
|
+
|
|
1184
1262
|
# Decode base64 content
|
|
1185
1263
|
if result.is_a?(Hash) && result['content'] && result['encoding'] == 'base64'
|
|
1186
1264
|
decoded = Base64.decode64(result['content'].gsub(/\s/, ''))
|
|
@@ -1189,15 +1267,16 @@ def fetch_readme(repo_full_name)
|
|
|
1189
1267
|
unless decoded.valid_encoding?
|
|
1190
1268
|
decoded = decoded.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '?')
|
|
1191
1269
|
end
|
|
1192
|
-
#
|
|
1193
|
-
|
|
1270
|
+
# Filter markdown clutter and limit README display
|
|
1271
|
+
filtered = filter_markdown_clutter(decoded)
|
|
1272
|
+
return filtered.lines.first(20).join.strip
|
|
1194
1273
|
end
|
|
1195
1274
|
rescue => e
|
|
1196
1275
|
log_debug("Error fetching README #{filename}: #{e.message}")
|
|
1197
1276
|
next
|
|
1198
1277
|
end
|
|
1199
1278
|
end
|
|
1200
|
-
|
|
1279
|
+
|
|
1201
1280
|
nil
|
|
1202
1281
|
end
|
|
1203
1282
|
|
|
@@ -1227,20 +1306,19 @@ def fetch_repo_files(repo_full_name, path = '')
|
|
|
1227
1306
|
# Show directories first, then files
|
|
1228
1307
|
(dirs + files).each do |item|
|
|
1229
1308
|
icon = case item['type']
|
|
1230
|
-
when 'dir' then '
|
|
1309
|
+
when 'dir' then '▶'
|
|
1231
1310
|
when 'file'
|
|
1232
1311
|
case File.extname(item['name']).downcase
|
|
1233
|
-
when '.md' then '
|
|
1234
|
-
when '.rb' then '
|
|
1235
|
-
when '.py' then '
|
|
1236
|
-
when '.js' then '
|
|
1237
|
-
when '.json' then '
|
|
1238
|
-
|
|
1239
|
-
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 '◦'
|
|
1240
1318
|
end
|
|
1241
|
-
else '
|
|
1319
|
+
else '?'
|
|
1242
1320
|
end
|
|
1243
|
-
|
|
1321
|
+
|
|
1244
1322
|
size_info = item['size'] ? " (#{format_file_size(item['size'])})" : ""
|
|
1245
1323
|
content += "#{icon} #{item['name']}#{size_info}\n"
|
|
1246
1324
|
end
|
|
@@ -2127,8 +2205,33 @@ def update_log_selection(old_index, new_index)
|
|
|
2127
2205
|
end
|
|
2128
2206
|
|
|
2129
2207
|
def update_branches_selection(old_index, new_index)
|
|
2130
|
-
|
|
2131
|
-
|
|
2208
|
+
return if @branches.empty?
|
|
2209
|
+
|
|
2210
|
+
lines_to_update = []
|
|
2211
|
+
|
|
2212
|
+
# Update old selection (remove marker)
|
|
2213
|
+
if old_index >= 0 && old_index < @branches.length
|
|
2214
|
+
branch = @branches[old_index]
|
|
2215
|
+
if branch[:current]
|
|
2216
|
+
old_line = ' * ' + branch[:name].fg(154)
|
|
2217
|
+
else
|
|
2218
|
+
old_line = ' ' + branch[:name]
|
|
2219
|
+
end
|
|
2220
|
+
lines_to_update << { index: old_index, content: old_line }
|
|
2221
|
+
end
|
|
2222
|
+
|
|
2223
|
+
# Update new selection (add marker)
|
|
2224
|
+
if new_index >= 0 && new_index < @branches.length
|
|
2225
|
+
branch = @branches[new_index]
|
|
2226
|
+
if branch[:current]
|
|
2227
|
+
new_line = '→ * ' + branch[:name].fg(154)
|
|
2228
|
+
else
|
|
2229
|
+
new_line = '→ ' + branch[:name]
|
|
2230
|
+
end
|
|
2231
|
+
lines_to_update << { index: new_index, content: new_line }
|
|
2232
|
+
end
|
|
2233
|
+
|
|
2234
|
+
update_pane_lines(lines_to_update)
|
|
2132
2235
|
end
|
|
2133
2236
|
|
|
2134
2237
|
def update_github_search_selection(old_index, new_index)
|
|
@@ -2259,7 +2362,7 @@ def update_right_pane(fast_update = false)
|
|
|
2259
2362
|
when :log
|
|
2260
2363
|
show_commit_details(@log_entries[@index][:hash]) if @index >= 0 && @index < @log_entries.length
|
|
2261
2364
|
when :branches
|
|
2262
|
-
|
|
2365
|
+
show_branch_details(@branches[@index]) if @index >= 0 && @index < @branches.length
|
|
2263
2366
|
when :github_repos
|
|
2264
2367
|
log_debug("GitHub repos mode: showing repo #{@index}/#{@github_repos.length}")
|
|
2265
2368
|
show_repo_details(@github_repos[@index], !fast_update) if @index >= 0 && @index < @github_repos.length
|
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.
|
|
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-
|
|
11
|
+
date: 2025-10-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rcurses
|
|
@@ -54,8 +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.
|
|
58
|
-
|
|
57
|
+
Version 2.0.3: Improved README display with markdown filtering and urxvt-compatible
|
|
58
|
+
symbols.'
|
|
59
59
|
email:
|
|
60
60
|
- g@isene.com
|
|
61
61
|
executables:
|