rtfm-filemanager 8.2.3 → 8.2.4
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/bin/rtfm +22 -6
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9578236347587df8d2eb07db00d7a667093344d95a60103a5df3fc2819df9f9a
|
|
4
|
+
data.tar.gz: 36ba2c5bc4b229d53200708da04fc29cc7e013fc9fee7c4abc8d10a6ba055eb7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f11d1c5405086f0a90ab186fb349a571c2af82c1e0d9b9f7513758a678db299dec69d8b9bde1c8b6f5eed91fc86d511457a29ba24287dbe2c57a04925e149240
|
|
7
|
+
data.tar.gz: bc1f862bdb325cfa015dbb6ba31146a338ef105b9e5400bdd5988b4d616d6b9788dd6ac7c7f1e41adcad5773d71a691c83a7f11233a9f7d93b7dd45df8007d33
|
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 = '8.2.
|
|
21
|
+
@version = '8.2.4' # Performance: cache MIME type lookups
|
|
22
22
|
|
|
23
23
|
# SAVE & STORE TERMINAL {{{1
|
|
24
24
|
ORIG_STTY = `stty -g`.chomp
|
|
@@ -494,6 +494,20 @@ def cmd?(cmd) # Helper function
|
|
|
494
494
|
system("which #{cmd} > /dev/null 2>&1")
|
|
495
495
|
end
|
|
496
496
|
|
|
497
|
+
def mime_type(path) # Cached MIME type lookup
|
|
498
|
+
mtime = File.mtime(path).to_i rescue 0
|
|
499
|
+
key = "#{path}:#{mtime}"
|
|
500
|
+
return @mime_cache[key] if @mime_cache[key]
|
|
501
|
+
result = `file --mime-type -b #{Shellwords.escape(path)} 2>/dev/null`.strip
|
|
502
|
+
if @mime_cache_size >= @max_mime_entries
|
|
503
|
+
@mime_cache.clear
|
|
504
|
+
@mime_cache_size = 0
|
|
505
|
+
end
|
|
506
|
+
@mime_cache[key] = result
|
|
507
|
+
@mime_cache_size += 1
|
|
508
|
+
result
|
|
509
|
+
end
|
|
510
|
+
|
|
497
511
|
# Initialize termpix for image display
|
|
498
512
|
@termpix = Termpix::Display.new
|
|
499
513
|
@showimage = @termpix.supported?
|
|
@@ -525,6 +539,9 @@ $stdin.set_encoding(Encoding::UTF_8)
|
|
|
525
539
|
@command_cache = {} # Cache for expensive shell commands
|
|
526
540
|
@command_cache_size = 0
|
|
527
541
|
@max_command_cache = 50
|
|
542
|
+
@mime_cache = {} # Cache for file MIME type lookups
|
|
543
|
+
@mime_cache_size = 0
|
|
544
|
+
@max_mime_entries = 200
|
|
528
545
|
|
|
529
546
|
# INITIALIZE VARIABLES {{{1
|
|
530
547
|
## These can be set by user in ~/.rtfm/conf
|
|
@@ -2121,9 +2138,8 @@ def show_file_properties # {{{3
|
|
|
2121
2138
|
|
|
2122
2139
|
# MIME type
|
|
2123
2140
|
begin
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
text << sprintf(" %-20s %s\n", "MIME Type:", mime_type.fg(156))
|
|
2141
|
+
mt = mime_type(@selected)
|
|
2142
|
+
text << sprintf(" %-20s %s\n", "MIME Type:", mt.fg(156))
|
|
2127
2143
|
rescue StandardError # file command failed
|
|
2128
2144
|
text << sprintf(" %-20s %s\n", "MIME Type:", "Unknown".fg(240))
|
|
2129
2145
|
end
|
|
@@ -6382,7 +6398,7 @@ def get_interactive_program(file_path) # HELPER FOR OPEN_SELECTED TO USE @intera
|
|
|
6382
6398
|
end
|
|
6383
6399
|
else
|
|
6384
6400
|
# Check what xdg-open would use
|
|
6385
|
-
mimetype =
|
|
6401
|
+
mimetype = mime_type(file_path)
|
|
6386
6402
|
desktop_file = `xdg-mime query default #{Shellwords.escape(mimetype)}`.chomp
|
|
6387
6403
|
|
|
6388
6404
|
if desktop_file && !desktop_file.empty?
|
|
@@ -6752,7 +6768,7 @@ def showcontent # SHOW CONTENTS IN THE RIGHT WINDOW {{{2
|
|
|
6752
6768
|
@image = true
|
|
6753
6769
|
else
|
|
6754
6770
|
# Check if file is text using the `file` command
|
|
6755
|
-
file_type =
|
|
6771
|
+
file_type = mime_type(@selected)
|
|
6756
6772
|
if file_type.start_with?('text/') || file_type == 'application/x-empty'
|
|
6757
6773
|
# It's a text file - fall through to text preview below
|
|
6758
6774
|
else
|
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: 8.2.
|
|
4
|
+
version: 8.2.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Geir Isene
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-03-
|
|
11
|
+
date: 2026-03-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rcurses
|