rtfm-filemanager 3.5 → 3.8
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/README.md +3 -0
- data/bin/rtfm +18 -39
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3699cc2dad80b5897439a8dae2a37a6865f2ce4eaab7f9f4f145aa81680796a8
|
4
|
+
data.tar.gz: d8d969d05f715d99a6bf610771559810202da03b4de75d272c8ffb30f58b5e02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3498bc171b280b56c4a4661a8f4c41a9b4878392cefd8f9a33907d0d8dab771d4627e662b48fb3e23569c2433d6f9070c5d16068d6d350bd054e61f74e392517
|
7
|
+
data.tar.gz: f17194010e4c9e218df33cfec4edaf0560c89c5e964709518d1374bc226ee094bd211695917dd96c249e35ace943d15e40798f47b6355bc9a82e9530d7100369
|
data/README.md
CHANGED
@@ -64,6 +64,9 @@ of the selected item (directory or file) is shown in the right pane. The right
|
|
64
64
|
pane is also used to show information such as the currently tagged items, your
|
65
65
|
(book)marks, output from commands, etc.
|
66
66
|
|
67
|
+
When you start RTFM, you can supply a directory path as an argument to let
|
68
|
+
RTFM start up in that directory.
|
69
|
+
|
67
70
|
You can run any command in the bottom "command bar" and have the output
|
68
71
|
presented in the right pane. Use LEFT and RIGHT keys to go back and forth on
|
69
72
|
the command line, HOME to beginning of line, END to end of line, Backspace or
|
data/bin/rtfm
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
# for any damages resulting from its use. Further, I am under no
|
15
15
|
# obligation to maintain or extend this software. It is provided
|
16
16
|
# on an 'as is' basis without any expressed or implied warranty.
|
17
|
-
@version = "3.
|
17
|
+
@version = "3.8"
|
18
18
|
|
19
19
|
# PRELIMINARIES
|
20
20
|
@help = <<HELPTEXT
|
@@ -199,7 +199,6 @@ begin # BASIC SETUP
|
|
199
199
|
cmd?('bat') ? @bat = "bat" : @bat = "batcat"
|
200
200
|
|
201
201
|
STDIN.set_encoding(Encoding::UTF_8) # Set encoding for STDIN
|
202
|
-
LScolors = `echo $LS_COLORS` # Import LS_COLORS
|
203
202
|
|
204
203
|
## Curses setup
|
205
204
|
Curses.init_screen
|
@@ -251,8 +250,10 @@ begin # BASIC SETUP
|
|
251
250
|
if File.exist?(Dir.home+'/.rtfm.conf')
|
252
251
|
load(Dir.home+'/.rtfm.conf')
|
253
252
|
end
|
253
|
+
Dir.chdir(ARGV[0]) if Dir.exist?(ARGV[0]) and ARGV[0] !~ /\/tmp/
|
254
254
|
end
|
255
|
-
|
255
|
+
# CLASS EXTENSIONS
|
256
|
+
class Curses::Window
|
256
257
|
attr_accessor :fg, :bg, :attr, :text, :update, :pager, :pager_more, :pager_cmd, :locate, :nohistory
|
257
258
|
# General extensions (see https://github.com/isene/Ruby-Curses-Class-Extension)
|
258
259
|
def clr
|
@@ -282,16 +283,6 @@ class Curses::Window # CLASS EXTENSION
|
|
282
283
|
# RTFM specific extensions
|
283
284
|
end
|
284
285
|
# GENERIC FUNCTIONS
|
285
|
-
def get_ls_color(type) # GET THE COLOR FOR THE FILETYPE FROM IMPORTED LS_COLORS
|
286
|
-
bold = 0
|
287
|
-
begin
|
288
|
-
color = LScolors.match(/#{type}=\d*;\d*;(\d*)/)[1]
|
289
|
-
bold = 1 if LScolors.match(/#{type}=\d*;\d*;\d*;1/)
|
290
|
-
rescue
|
291
|
-
color = 7 # Default color
|
292
|
-
end
|
293
|
-
return color.to_i, bold
|
294
|
-
end
|
295
286
|
def syntax_highlight(input) # SYNTAX HIGHLIGHTING FROM ANSI COLOR CODES
|
296
287
|
color_ary = color_parse(input)
|
297
288
|
color_ary.each do | pair |
|
@@ -308,13 +299,15 @@ def syntax_highlight(input) # SYNTAX HIGHLIGHTING FROM ANSI COLOR CODES
|
|
308
299
|
end
|
309
300
|
end
|
310
301
|
def color_parse(input) # PARSE ANSI COLOR SEQUENCES
|
311
|
-
input.gsub!(
|
312
|
-
input.gsub!(
|
313
|
-
input.gsub!(
|
314
|
-
input.gsub!(
|
315
|
-
input.gsub!(
|
302
|
+
input.gsub!(/\e\[\d;38;5;(\d+);*(\d*)m/, '¤¤\1¤¤\2¤¤')
|
303
|
+
input.gsub!(/\e\[38;5;(\d+);*(\d*)m/, '¤¤\1¤¤\2¤¤')
|
304
|
+
input.gsub!(/\e\[\d;38;2;(\d+);*(\d*);\d*m/, '¤¤\1¤¤\2¤¤')
|
305
|
+
input.gsub!(/\e\[38;2;(\d+);*(\d*);\d*m/, '¤¤\1¤¤\2¤¤')
|
306
|
+
input.gsub!(/\e\[\d+;(\d+);*(\d*)m/, '¤¤\1¤¤\2¤¤')
|
307
|
+
input.gsub!(/\e\[0m/, "")
|
316
308
|
color_array = input.split("¤¤")
|
317
309
|
color_array = color_array.drop(1)
|
310
|
+
#color_array.map! { |x| x || 0 }
|
318
311
|
output = color_array.each_slice(3).to_a
|
319
312
|
return output
|
320
313
|
end
|
@@ -960,7 +953,8 @@ end
|
|
960
953
|
def get_files(win) # The core of the directory listings
|
961
954
|
ls_cmd = "ls 2>/dev/null #{@lsbase} #{@lsall} #{@lsorder} #{@lsinvert} #{@lsuser}" # Get files in current directory
|
962
955
|
ls_cmd += @selected_safe if win == "right"
|
963
|
-
@
|
956
|
+
@cfiles = `#{ls_cmd} --color`.split("\n")
|
957
|
+
@files = @cfiles.map {|f| f.sub(/^\e\[.*\dm(..*$)/, '\1').sub(/\e.+/, '')}
|
964
958
|
ls_cmd += " -H " if win == "right"
|
965
959
|
ls_cmd += %q[ -lh --time-style="long-iso" | awk '{printf "%s%s%s%11s%6s%6s", $1, " " $3, ":" $4,$6,$7,$5"\n"}']
|
966
960
|
@fspes = `#{ls_cmd}`.split("\n").drop(1)
|
@@ -1027,7 +1021,8 @@ def list_dir(active) # LIST CONTENT OF A DIRECTORY (BOTH active AND RIGHT WINDOW
|
|
1027
1021
|
@cont = ""
|
1028
1022
|
end
|
1029
1023
|
while ix < @files.size and t < win.maxy do
|
1030
|
-
str
|
1024
|
+
str = @files[ix]
|
1025
|
+
cstr = @cfiles[ix]
|
1031
1026
|
active ? str_path = str : str_path = "#{@selected}/#{str}"
|
1032
1027
|
begin # Add items matching @tag to @tagged
|
1033
1028
|
if str.match(/#{@tag}/) and @tag != false
|
@@ -1036,25 +1031,9 @@ def list_dir(active) # LIST CONTENT OF A DIRECTORY (BOTH active AND RIGHT WINDOW
|
|
1036
1031
|
end
|
1037
1032
|
rescue
|
1038
1033
|
end
|
1039
|
-
# Determine the filetype of the item
|
1040
|
-
ftype = ""
|
1041
|
-
ftype = str.match(/\.([^.]*$)/)[1] if str.match?(/\.([^.]*$)/)
|
1042
|
-
# Set special filetypes (sequence matters)
|
1043
|
-
ftype = "bd" if File.blockdev?(str_path)
|
1044
|
-
ftype = "cd" if File.chardev?(str_path)
|
1045
|
-
ftype = "pi" if File.pipe?(str_path)
|
1046
|
-
ftype = "st" if File.sticky?(str_path)
|
1047
|
-
ftype = "so" if File.socket?(str_path)
|
1048
|
-
ftype = "ex" if File.executable?(str_path)
|
1049
|
-
ftype = "di" if File.directory?(str_path)
|
1050
|
-
ftype = "ln" if File.symlink?(str_path)
|
1051
|
-
begin
|
1052
|
-
File.stat(str_path) # Checking if not an orphaned link
|
1053
|
-
rescue
|
1054
|
-
ftype = "or" # Set to orphant if no link target
|
1055
|
-
end
|
1056
1034
|
fg = 7; bold = 0; bg = 0 # Set default color
|
1057
|
-
|
1035
|
+
fl = color_parse(cstr)
|
1036
|
+
fg, bold = fl[0][0].to_i, fl[0][1].to_i unless fl[0] == nil
|
1058
1037
|
init_pair(fg, fg, bg)
|
1059
1038
|
file_marker = color_pair(fg)
|
1060
1039
|
file_marker = file_marker | Curses::A_BOLD if bold == 1
|
@@ -1708,7 +1687,7 @@ loop do # OUTER LOOP - CATCHING REFRESHES VIA 'r'
|
|
1708
1687
|
close_screen
|
1709
1688
|
# If launched via the script "r", return current dir and "r" will cd to that
|
1710
1689
|
begin
|
1711
|
-
File.write(ARGV[0], Dir.pwd) if ARGV[0] and ARGV[0].match(/\/tmp
|
1690
|
+
File.write(ARGV[0], Dir.pwd) if ARGV[0] and ARGV[0].match(/\/tmp/)
|
1712
1691
|
rescue
|
1713
1692
|
end
|
1714
1693
|
end
|
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: '3.
|
4
|
+
version: '3.8'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Geir Isene
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-05-
|
11
|
+
date: 2023-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: curses
|
@@ -47,7 +47,9 @@ dependencies:
|
|
47
47
|
description: 'A full featured terminal browser with syntax highlighted files, images
|
48
48
|
shown in the terminal, videos thumbnailed, etc. You can bookmark and jump around
|
49
49
|
easily, delete, rename, copy, symlink and move files. RTFM has a a wide range of
|
50
|
-
other features. New in 3.
|
50
|
+
other features. New in 3.8: Rewrite of core file listing engine for speedup. RTFM
|
51
|
+
now handles simpler LS_COLORS. You can now supply a path as argument at startup
|
52
|
+
to let RTFM start from that directory.'
|
51
53
|
email: g@isene.com
|
52
54
|
executables:
|
53
55
|
- rtfm
|