rtfm-filemanager 6.0.3 → 6.0.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 +17 -10
- 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: 485057b825685d870eba56b870704bdf27757f577a515a8bd734ef999cc0de21
|
4
|
+
data.tar.gz: 99a1d71b6e97cd29c8dee500460870df8f97a2e13a0a40734a679bd2313b3fb3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af06a49dc63aaaa43deb3095aab75cf797dae88e4fd1c7c7ef71234b8ba5be74c26dc216382a7f9a305b0057237bc216dbe1472991a1b711e5d49f476f589a90
|
7
|
+
data.tar.gz: 6c41d7940a9daef84173385807e910ed6110571add6d6cde88e4d5aae09f096d8cda62040f523b0cedd4877f51d1b023ec8aaef727c405d019cd764523646ccb
|
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.
|
21
|
+
@version = '6.0.4' # Fixed preview handler regex bug causing false matches
|
22
22
|
|
23
23
|
# SAVE & STORE TERMINAL {{{1
|
24
24
|
ORIG_STTY = `stty -g`.chomp
|
@@ -853,7 +853,7 @@ end
|
|
853
853
|
# Compile into an array of [Regexp, template] for fast lookup
|
854
854
|
PREVIEW_HANDLERS = preview_specs.map do |exts_str, tmpl|
|
855
855
|
exts = exts_str.split(',').map(&:strip).map { |ext| Regexp.escape(ext) }.join('|')
|
856
|
-
[
|
856
|
+
[/\.(#{exts})$/i, tmpl]
|
857
857
|
end
|
858
858
|
|
859
859
|
# KEY DISPATCH TABLE & HANDLERS {{{1
|
@@ -5022,13 +5022,16 @@ def showcontent # SHOW CONTENTS IN THE RIGHT WINDOW {{{2
|
|
5022
5022
|
temp.write(preview_content)
|
5023
5023
|
temp.close
|
5024
5024
|
|
5025
|
-
|
5026
|
-
|
5027
|
-
|
5025
|
+
# Try bat with robust fallback
|
5026
|
+
bat_cmd = "#{@bat} -n --color=always #{Shellwords.escape(temp.path)}"
|
5027
|
+
bat_output = command(bat_cmd, timeout: 10)
|
5028
|
+
if bat_output.empty?
|
5029
|
+
# Bat failed or returned empty - show plain text
|
5028
5030
|
@pR.say(preview_content)
|
5029
|
-
|
5030
|
-
|
5031
|
+
else
|
5032
|
+
@pR.say(bat_output)
|
5031
5033
|
end
|
5034
|
+
temp.unlink
|
5032
5035
|
else
|
5033
5036
|
@pR.say(preview_content)
|
5034
5037
|
end
|
@@ -5042,10 +5045,14 @@ def showcontent # SHOW CONTENTS IN THE RIGHT WINDOW {{{2
|
|
5042
5045
|
text = File.read(@selected).force_encoding('UTF-8') rescue ''
|
5043
5046
|
if text.valid_encoding?
|
5044
5047
|
if @batuse
|
5045
|
-
|
5046
|
-
|
5047
|
-
|
5048
|
+
# Try bat first, with robust fallback
|
5049
|
+
bat_cmd = "#{@bat} -n --color=always #{Shellwords.escape(@selected)}"
|
5050
|
+
bat_output = command(bat_cmd, timeout: 10)
|
5051
|
+
if bat_output.empty?
|
5052
|
+
# Bat failed or returned empty - try plain cat
|
5048
5053
|
showcommand("cat #{Shellwords.escape(@selected)}")
|
5054
|
+
else
|
5055
|
+
@pR.say(bat_output)
|
5049
5056
|
end
|
5050
5057
|
else
|
5051
5058
|
showcommand("cat #{Shellwords.escape(@selected)}")
|
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.
|
4
|
+
version: 6.0.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: 2025-07-
|
11
|
+
date: 2025-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rcurses
|