rtfm-filemanager 6.0.1 → 6.0.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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/rtfm +117 -5
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3752dbc07e02a59b08ddd5e32d5ec664cfc8b9cf167359cc953bfbe766c24cbc
4
- data.tar.gz: 278bdf15a4b8076eeb98bd12efa29ac6564edc8110a191be6c24a8d5072308ac
3
+ metadata.gz: 3e28b4f69f6fb7abda7b7b518346816587179821d732a1aa6b8d7d1c653cd909
4
+ data.tar.gz: 2360ec5bd5ddc7dbd823ba19db9f39c6f46034729bfd95241cb0e7faa71fcfbc
5
5
  SHA512:
6
- metadata.gz: 3bb51eba0068c498583e7c3187e540f31d0b548713303f245dd78bea74f62570105f75edc8c71066a7b0afbb281b573b2c1fe39ebf6a965decc8bb992e3f388e
7
- data.tar.gz: 7e35a9382af8a119942179eb1b5f6764c093f9fcd1b40310c3e414cdd4f4214741ef08a2ea07f8acafbeb4a0def6d632fb463a5faf3eae9822fda36d9323c345
6
+ metadata.gz: 420d105635956faddb7a1a289c44fcc0cbea927492ecac76369aec4d02cf72221e53393a5c6cc1252fcbe83b15659f5ab9537e3b4cc8a4ac500c27dffbe31257
7
+ data.tar.gz: bf605aa7b3a33c3ef04f9306ac60daf5156051d3200004b2532806a1a30b5fa0eacab8f120a335e3eaf5d3401c4acce47812554b070e6edc443e15f0122fd381
data/bin/rtfm CHANGED
@@ -18,7 +18,7 @@
18
18
  # get a great understanding of the code itself by simply sending
19
19
  # or pasting this whole file into you favorite AI for coding with
20
20
  # a prompt like this: "Help me understand every part of this code".
21
- @version = '6.0.1' # Remote mode fixes: FrozenError fix, enhanced upload workflow, refresh functionality
21
+ @version = '6.0.2' # Terminal state bug fix for vim editing, enhanced Git status display
22
22
 
23
23
  # SAVE & STORE TERMINAL {{{1
24
24
  ORIG_STTY = `stty -g`.chomp
@@ -3394,10 +3394,114 @@ end
3394
3394
  # GIT/HASH/OPENAI {{{2
3395
3395
  def git_status # {{{3
3396
3396
  @pR.clear
3397
- out, err = command('git status', return_both: true)
3398
- @pR.text += err.fg(196) unless err.empty?
3399
- @pR.text += out.fg(214) unless out.empty?
3400
- @pR.full_refresh
3397
+
3398
+ # Check if we're in a git repository
3399
+ unless Dir.exist?('.git') || system('git rev-parse --git-dir > /dev/null 2>&1')
3400
+ @pR.say("Not a Git Repository".b.fg(196) + "\n\n" + "This directory is not under Git version control.".fg(240))
3401
+ @pR.update = false
3402
+ @pB.update = true
3403
+ return
3404
+ end
3405
+
3406
+ # Get git status with porcelain format for parsing
3407
+ status_out, status_err = command('git status --porcelain', return_both: true)
3408
+
3409
+ # Get branch info
3410
+ branch_out, branch_err = command('git branch --show-current', return_both: true)
3411
+ current_branch = branch_out.chomp
3412
+
3413
+ # Get commit info
3414
+ commit_out, commit_err = command('git log --oneline -n 5 2>/dev/null || echo "No commits"', return_both: true)
3415
+
3416
+ # Build formatted output
3417
+ info = "Git Status".b.fg(156) + "\n"
3418
+ info << "=" * 50 + "\n\n"
3419
+
3420
+ # Show errors if any
3421
+ unless status_err.empty? && branch_err.empty?
3422
+ info << "Errors:".fg(196) + "\n"
3423
+ info << status_err.fg(196) unless status_err.empty?
3424
+ info << branch_err.fg(196) unless branch_err.empty?
3425
+ info << "\n"
3426
+ end
3427
+
3428
+ # Branch information
3429
+ if current_branch.empty?
3430
+ info << "Branch: ".fg(226) + "Not on any branch".fg(240) + "\n\n"
3431
+ else
3432
+ info << "Branch: ".fg(226) + current_branch.fg(156).b + "\n\n"
3433
+ end
3434
+
3435
+ # Parse and categorize changes
3436
+ if status_out.empty?
3437
+ info << "Working directory clean".fg(156) + "\n"
3438
+ else
3439
+ staged = []
3440
+ modified = []
3441
+ untracked = []
3442
+
3443
+ status_out.lines.each do |line|
3444
+ status_code = line[0..1]
3445
+ filename = line[3..-1].chomp
3446
+
3447
+ case status_code
3448
+ when /^[MADRC]./
3449
+ staged << [status_code[0], filename]
3450
+ when /^.[MD]/
3451
+ modified << [status_code[1], filename]
3452
+ when '??'
3453
+ untracked << filename
3454
+ end
3455
+ end
3456
+
3457
+ # Show staged changes
3458
+ unless staged.empty?
3459
+ info << "Staged for commit:".fg(156) + "\n"
3460
+ staged.each do |status, file|
3461
+ status_text = case status
3462
+ when 'M' then 'modified'
3463
+ when 'A' then 'new file'
3464
+ when 'D' then 'deleted'
3465
+ when 'R' then 'renamed'
3466
+ when 'C' then 'copied'
3467
+ else 'changed'
3468
+ end
3469
+ info << sprintf(" %-10s %s\n", status_text.fg(156), file.fg(249))
3470
+ end
3471
+ info << "\n"
3472
+ end
3473
+
3474
+ # Show modified files
3475
+ unless modified.empty?
3476
+ info << "Changes not staged:".fg(220) + "\n"
3477
+ modified.each do |status, file|
3478
+ status_text = status == 'M' ? 'modified' : 'deleted'
3479
+ info << sprintf(" %-10s %s\n", status_text.fg(220), file.fg(249))
3480
+ end
3481
+ info << "\n"
3482
+ end
3483
+
3484
+ # Show untracked files
3485
+ unless untracked.empty?
3486
+ info << "Untracked files:".fg(240) + "\n"
3487
+ untracked.first(10).each do |file|
3488
+ info << sprintf(" %-10s %s\n", "new".fg(240), file.fg(249))
3489
+ end
3490
+ info << " (showing first 10)\n".fg(240) if untracked.length > 10
3491
+ info << "\n"
3492
+ end
3493
+ end
3494
+
3495
+ # Recent commits
3496
+ unless commit_out.chomp == "No commits"
3497
+ info << "Recent commits:".fg(226) + "\n"
3498
+ commit_out.lines.first(5).each_with_index do |commit, i|
3499
+ hash, *message = commit.chomp.split(' ', 2)
3500
+ info << sprintf(" %s %s\n", hash.fg(214), message.join(' ').fg(249))
3501
+ end
3502
+ end
3503
+
3504
+ @pR.say(info)
3401
3505
  @pR.update = false
3402
3506
  @pB.update = true
3403
3507
  end
@@ -4719,6 +4823,14 @@ def open_selected(html = nil) # OPEN SELECTED FILE {{{2
4719
4823
  end
4720
4824
  # Don't try to read large files or PDFs as text for validation
4721
4825
  if !@selected&.match(@pdffile) && File.size(@selected) < 1_000_000 && File.read(@selected).force_encoding('UTF-8').valid_encoding? # Pure text
4826
+ # Flush any pending input before switching terminal modes
4827
+ while IO.select([$stdin], nil, nil, 0)
4828
+ begin
4829
+ $stdin.read_nonblock(4096)
4830
+ rescue IO::WaitReadable, EOFError
4831
+ break
4832
+ end
4833
+ end
4722
4834
  system("stty #{ORIG_STTY} < /dev/tty")
4723
4835
  # Clear to top-left
4724
4836
  system('clear < /dev/tty > /dev/tty')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rtfm-filemanager
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.1
4
+ version: 6.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geir Isene
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-07-03 00:00:00.000000000 Z
11
+ date: 2025-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rcurses