rtfm-filemanager 7.0.0 → 7.0.1
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 +17 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d089d1bfe95a340e6979a12e7a1cdf648218b2089a761198e48495927b6c397b
|
4
|
+
data.tar.gz: 2a728824fe81ad20c8dca96e586c8ad70a0b98896753f42984bd696b5aef03b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52f5ebc86450d31acd054e136ff3acee035602de7f19549f54cb3290ddd36c5ee9361a34e5147deb7bdbfcee56bfb653491c221cf8b10c20afaa883860249c19
|
7
|
+
data.tar.gz: 65b034c640c804d40c8ed17a1d37ee5b759524c9f3407e1d73ac9892842a4e8280977df30f1ef2e6e94d3515ef130c6ede8a3b096bc37738b70f23287c08a870
|
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 = '
|
21
|
+
@version = '7.0.1' # Re-enabled directory caching for major performance improvement
|
22
22
|
|
23
23
|
# SAVE & STORE TERMINAL {{{1
|
24
24
|
ORIG_STTY = `stty -g`.chomp
|
@@ -501,6 +501,9 @@ $stdin.set_encoding(Encoding::UTF_8)
|
|
501
501
|
@metadata_cache = {}
|
502
502
|
@metadata_cache_size = 0
|
503
503
|
@max_metadata_entries = 100
|
504
|
+
@command_cache = {} # Cache for expensive shell commands
|
505
|
+
@command_cache_size = 0
|
506
|
+
@max_command_cache = 50
|
504
507
|
|
505
508
|
# INITIALIZE VARIABLES {{{1
|
506
509
|
## These can be set by user in ~/.rtfm/conf
|
@@ -4213,8 +4216,17 @@ end
|
|
4213
4216
|
|
4214
4217
|
# GENERIC FUNCTIONS {{{1
|
4215
4218
|
def get_cached_dirlist(dir, ls_options) # {{{2
|
4216
|
-
#
|
4217
|
-
|
4219
|
+
# Generate cache key with directory mtime for automatic invalidation
|
4220
|
+
begin
|
4221
|
+
dir_mtime = File.mtime(dir).to_i
|
4222
|
+
cache_key = "#{dir}:#{ls_options}:#{dir_mtime}"
|
4223
|
+
rescue
|
4224
|
+
return nil # Can't cache if we can't get mtime
|
4225
|
+
end
|
4226
|
+
|
4227
|
+
# Return cached result if available and fresh
|
4228
|
+
cached = @dir_cache[cache_key]
|
4229
|
+
return cached if cached
|
4218
4230
|
|
4219
4231
|
# Clean old cache entries if cache is getting too large
|
4220
4232
|
if @dir_cache_size >= @max_cache_entries
|
@@ -4228,11 +4240,11 @@ def get_cached_dirlist(dir, ls_options) # {{{2
|
|
4228
4240
|
colorls = command("ls --color #{Shellwords.escape(dir)} #{ls_options} #{@lslong}").split("\n")
|
4229
4241
|
|
4230
4242
|
result = { purels: purels, colorls: colorls }
|
4231
|
-
@dir_cache[
|
4243
|
+
@dir_cache[cache_key] = result
|
4232
4244
|
@dir_cache_size += 1
|
4233
4245
|
|
4234
4246
|
# Clean up old entries for this directory
|
4235
|
-
@dir_cache.delete_if { |key, _| key.start_with?("#{dir}:") && key !=
|
4247
|
+
@dir_cache.delete_if { |key, _| key.start_with?("#{dir}:") && key != cache_key }
|
4236
4248
|
|
4237
4249
|
result
|
4238
4250
|
rescue => e
|