rtfm-filemanager 6.0.9 → 6.0.11
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 +66 -7
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3bd4479747f5beca81bc4706028e03670623f615a03b57fa0977b05ab3f545f3
|
4
|
+
data.tar.gz: 02b5fa470a870fd2bfb911047ac0bf753a3147800722c2ad6e39b28f0c0f56bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1804a401ce8f0c2a95bd87b652e06f8bbdd7982f22989ba615938b831a8a3bf19a08f2a7d4702b985e66c650cff930766cdc5d3d5081d0e6a205f9056f34e39b
|
7
|
+
data.tar.gz: 5f98f9999120a4bc6d2529f01770c5f87d35bded515f63514b162a153b1c089d712e9d86bbb4610d4c956229e2a961173cf6c5fdcf1475d3508b5a104f429a6b
|
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.11' # Added SVG file preview support with ImageMagick conversion
|
22
22
|
|
23
23
|
# SAVE & STORE TERMINAL {{{1
|
24
24
|
ORIG_STTY = `stty -g`.chomp
|
@@ -822,11 +822,11 @@ preview_specs = {
|
|
822
822
|
'xls' => "xls2csv @s 2>/dev/null",
|
823
823
|
'ppt' => "catppt @s 2>/dev/null",
|
824
824
|
# images ⇒ nil => call showimage
|
825
|
-
'png, jpg, jpeg, bmp, gif, webp, tif, tiff' => nil,
|
825
|
+
'png, jpg, jpeg, bmp, gif, webp, tif, tiff, svg' => nil,
|
826
826
|
# video ⇒ nil, but detected via pattern below
|
827
827
|
'mpg, mpeg, avi, mov, mkv, mp4' => nil
|
828
828
|
}
|
829
|
-
@imagefile ||= /\.(?:png|jpe?g|bmp|gif|webp|tiff
|
829
|
+
@imagefile ||= /\.(?:png|jpe?g|bmp|gif|webp|tiff?|svg)$/i
|
830
830
|
@pdffile ||= /\.pdf$/i
|
831
831
|
# rubocop:enable Style/StringLiterals
|
832
832
|
|
@@ -4045,8 +4045,19 @@ def command_mode # {{{3
|
|
4045
4045
|
force = raw.start_with?('§')
|
4046
4046
|
raw = raw[1..].strip if force
|
4047
4047
|
# Expand @s / @t
|
4048
|
-
|
4049
|
-
|
4048
|
+
# Check if this is a GUI application that needs unescaped filenames
|
4049
|
+
gui_apps = %w[evince okular xdg-open firefox chromium nautilus thunar dolphin gwenview eog]
|
4050
|
+
first_word = raw.split.first
|
4051
|
+
|
4052
|
+
if gui_apps.include?(first_word)
|
4053
|
+
# For GUI apps, quote the filename instead of escaping
|
4054
|
+
sel = '"' + @selected.to_s.gsub('"', '\\"') + '"'
|
4055
|
+
tg = @tagged.map { |p| '"' + p.gsub('"', '\\"') + '"' }.join(' ')
|
4056
|
+
else
|
4057
|
+
# For command-line tools, use shell escaping
|
4058
|
+
sel = Shellwords.escape(@selected.to_s)
|
4059
|
+
tg = @tagged.map { |p| Shellwords.escape(p) }.join(' ')
|
4060
|
+
end
|
4050
4061
|
cmd = raw.gsub('@s', sel).gsub('@t', tg)
|
4051
4062
|
|
4052
4063
|
# Handle cd commands specially
|
@@ -5153,15 +5164,63 @@ def showcontent # SHOW CONTENTS IN THE RIGHT WINDOW {{{2
|
|
5153
5164
|
entry = PREVIEW_HANDLERS.find { |re, _| re.match?(@selected) }
|
5154
5165
|
pattern, tmpl = entry || [nil, nil]
|
5155
5166
|
if tmpl # Command-based preview
|
5156
|
-
escaped = Shellwords.escape(@selected)
|
5157
5167
|
if !@batuse && tmpl.match?(/\b#{@bat}\b/)
|
5168
|
+
escaped = Shellwords.escape(@selected)
|
5158
5169
|
showcommand("cat #{escaped}")
|
5159
5170
|
else
|
5160
|
-
|
5171
|
+
# For complex commands with pipes, we need to quote the filename
|
5172
|
+
# within the shell command string since it's executed via bash -c
|
5173
|
+
# First escape any single quotes in the filename
|
5174
|
+
safe_filename = @selected.gsub("'", "'\"'\"'")
|
5175
|
+
# Then wrap in single quotes for the shell command
|
5176
|
+
cmd = tmpl.gsub('@s', "'#{safe_filename}'")
|
5161
5177
|
showcommand(cmd)
|
5162
5178
|
end
|
5163
5179
|
elsif pattern # Nil template → image or video
|
5164
5180
|
case @selected
|
5181
|
+
when /\.svg$/i
|
5182
|
+
# Convert SVG to PNG for display
|
5183
|
+
begin
|
5184
|
+
file_size = File.size(@selected)
|
5185
|
+
if file_size > 50_000_000 # 50MB limit for images
|
5186
|
+
@pR.say("SVG too large for preview (#{(file_size / 1024.0 / 1024.0).round(1)}MB > 50MB limit)")
|
5187
|
+
else
|
5188
|
+
tn = '/tmp/rtfm_svg_preview.png'
|
5189
|
+
# Try direct conversion first
|
5190
|
+
if system("convert #{Shellwords.escape(@selected)} #{Shellwords.escape(tn)} 2>/dev/null")
|
5191
|
+
showimage(tn)
|
5192
|
+
@image = true
|
5193
|
+
else
|
5194
|
+
# If direct conversion fails, try fixing XML entities and retry
|
5195
|
+
temp_svg = '/tmp/rtfm_svg_fixed.svg'
|
5196
|
+
begin
|
5197
|
+
content = File.read(@selected, encoding: 'UTF-8')
|
5198
|
+
# Fix common XML entity issues (replace unescaped ampersands)
|
5199
|
+
# First escape all &, then restore valid entities
|
5200
|
+
fixed_content = content.gsub('&', '&')
|
5201
|
+
.gsub('&', '&')
|
5202
|
+
.gsub('&lt;', '<')
|
5203
|
+
.gsub('&gt;', '>')
|
5204
|
+
.gsub('&quot;', '"')
|
5205
|
+
.gsub('&apos;', ''')
|
5206
|
+
.gsub(/&#(\d+);/, '&#\1;')
|
5207
|
+
.gsub(/&#x([0-9a-fA-F]+);/, '&#x\1;')
|
5208
|
+
File.write(temp_svg, fixed_content)
|
5209
|
+
|
5210
|
+
if system("convert #{Shellwords.escape(temp_svg)} #{Shellwords.escape(tn)} 2>/dev/null")
|
5211
|
+
showimage(tn)
|
5212
|
+
@image = true
|
5213
|
+
else
|
5214
|
+
@pR.say("Error converting SVG to PNG for preview")
|
5215
|
+
end
|
5216
|
+
ensure
|
5217
|
+
File.delete(temp_svg) if File.exist?(temp_svg)
|
5218
|
+
end
|
5219
|
+
end
|
5220
|
+
end
|
5221
|
+
rescue => e
|
5222
|
+
@pR.say("Error processing SVG: #{e}")
|
5223
|
+
end
|
5165
5224
|
when /\.(?:png|jpe?g|bmp|gif|webp|tiff?)$/i
|
5166
5225
|
# Allow larger image files up to 50MB
|
5167
5226
|
begin
|
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.11
|
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-
|
11
|
+
date: 2025-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rcurses
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '7.4'
|
55
55
|
description: |-
|
56
|
-
RTFM v6.0.
|
56
|
+
RTFM v6.0.11: Added SVG file preview support with ImageMagick conversion to PNG for display.
|
57
57
|
A full featured terminal browser with syntax highlighted files, images shown in the terminal, videos thumbnailed, etc. Features include remote SSH/SFTP browsing, interactive SSH shell, comprehensive undo system, bookmarks, and much more. You can bookmark and jump around easily, delete, rename, copy, symlink and move files. RTFM is one of the most feature-packed terminal file managers.
|
58
58
|
email: g@isene.com
|
59
59
|
executables:
|