rtfm-filemanager 2.1 → 2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -3
- data/bin/rtfm +51 -28
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d7099e1d453f30470918460a94ed63c4fe27f9aeabaf048d5d49f28c5f5f492
|
4
|
+
data.tar.gz: 316001942094dc0323d27959341fcfd0b4abf380ac7e709235dfec33561931d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fba204a6f59db705c929a3efd21043013a405db024f3ad415c80aeca4f2d8961e14f114409d766620a189a4fc8b1d0492b554d40f3c085e3594a599f5bfe0cf1
|
7
|
+
data.tar.gz: 4adbff6448f6c3bbd1dde25260d32d9dd4ec032892e7f82fa73c1db6d5733e38e9fefc580f0968ce65e1b252c33dbb57788a63c9f048a4c935961097da6b6665
|
data/README.md
CHANGED
@@ -147,7 +147,7 @@ M | Show marked items in right pane
|
|
147
147
|
n | Jump to the next item matched by '/'
|
148
148
|
N | Jump to the previous item matched by '/'
|
149
149
|
~ | Jump to Home directory
|
150
|
-
|
150
|
+
\> | Follow symlink to the directory where the target resides
|
151
151
|
L | Start 'locate' search for files, then use '#' to jump to desired line/directory
|
152
152
|
|
153
153
|
### Tagging
|
@@ -180,7 +180,6 @@ i | Invert/reverse the sorting
|
|
180
180
|
O | Show the Ordering in the bottom window (the full ls command)
|
181
181
|
G | Show git status for current directory
|
182
182
|
H | Do a cryptographic hash of the current directory with subdirs. If a previous hash was made, compare and report if there has been any change
|
183
|
-
S | Show comprehensive system info (system, CPU, filesystem, latest dmesg messages)
|
184
183
|
I | Show OpenAI's description of the selected item and its content (if available). You must have installed the ruby-openai gem and added your openai secret key in the .rtfm.conf (add `@ai = "your-secret-openai-key") for this to work. If RTFM is installed as a gem, the ruby-openai gem is included in the installation
|
185
184
|
|
186
185
|
### Right pane
|
@@ -198,12 +197,14 @@ _ | Toggle preview of images in right pane
|
|
198
197
|
|
199
198
|
Key | Description
|
200
199
|
-------|------------------------------------------------------------------
|
201
|
-
|
200
|
+
f | Show only files in the left pane matching extension(s) (e.g. "txt" or "pdf,png,jpg")
|
201
|
+
F | Show only files matching a pattern (Ruby Regex) (e.g. "abc" or "ab.+12(\w3)*")
|
202
202
|
g | Run 'grep' to show files that contains the MATCH in current directory
|
203
203
|
: | Enter "command mode" in bottom window (press ENTER to execute, press Ctrl-G to escape)
|
204
204
|
; | Show command history in right pane
|
205
205
|
y | Copy path of selected item to primary selection (for pasting with middle mouse button)
|
206
206
|
Y | Copy path of selected item to clipboard
|
207
|
+
S | Show comprehensive system info (system, CPU, filesystem, latest dmesg messages)
|
207
208
|
|
208
209
|
|
209
210
|
## A convenient shell function
|
data/bin/rtfm
CHANGED
@@ -48,11 +48,11 @@ JUMPING AND MARKS
|
|
48
48
|
' = Jump to mark (next letter is the name of the mark [a-zA-Z'])
|
49
49
|
The 5 latest directories visited are stored in marks 1-5 (1 being the very latest)
|
50
50
|
/ = Enter search string in bottom window to highlight matching items and jump to the first match
|
51
|
-
|
51
|
+
\ = Remove search pattern
|
52
52
|
n = Jump to the next item matched by '/'
|
53
53
|
N = Jump to the previous item matched by '/'
|
54
54
|
~ = Jump to Home directory
|
55
|
-
|
55
|
+
> = Follow symlink to the directory where the target resides
|
56
56
|
L = Start 'locate' search for files, then use '#' to jump to desired line/directory
|
57
57
|
|
58
58
|
TAGGING
|
@@ -77,7 +77,6 @@ DIRECTORY VIEWS
|
|
77
77
|
G = Show git status for current directory
|
78
78
|
H = Do a cryptographic hash of the current directory with subdirs
|
79
79
|
If a previous hash was made, compare and report if there has been any change
|
80
|
-
S = Show comprehensive system info (system, CPU, filesystem, latest dmesg messages)
|
81
80
|
I = Show OpenAI's description of the selected item and its content (if available)
|
82
81
|
You must have installed the ruby-openai gem and added your openai secret key
|
83
82
|
in the .rtfm.conf (add `@ai = "your-secret-openai-key") for this to work.
|
@@ -87,16 +86,18 @@ RIGHT PANE
|
|
87
86
|
TAB = Next page of the preview (if doc long and ∇ in the bottom right)
|
88
87
|
S-TAB = Previous page (if you have moved down the document first - ∆ in the top right)
|
89
88
|
w = Change the width of the left/right panes (left pane ⇒ ⅓ ⇒ ¼ ⇒ ⅕ ⇒ ⅙ ⇒ ½ ⇒ ⅓)
|
90
|
-
- = Toggle preview in right pane (turn it off for faster traversing of directories)
|
91
|
-
_ = Toggle preview of images in right pane
|
89
|
+
- = (Minus sign) Toggle preview in right pane (turn it off for faster traversing of directories)
|
90
|
+
_ = (Underscore) Toggle preview of images in right pane
|
92
91
|
|
93
92
|
ADDITINAL COMMANDS
|
94
|
-
|
93
|
+
f = Show only files in the left pane matching extension(s) (e.g. "txt" or "pdf,png,jpg")
|
94
|
+
F = Show only files matching a pattern (Ruby Regex) (e.g. "abc" or "ab.+12(\w3)*")
|
95
95
|
g = Run 'grep' to show files that contains the MATCH in current directory
|
96
96
|
: = Enter "command mode" in bottom window (press ENTER to execute, press Ctrl-G to escape)
|
97
97
|
; = Show command history in right pane
|
98
98
|
y = Copy path of selected item to primary selection (for pasting with middle mouse button)
|
99
99
|
Y = Copy path of selected item to clipboard
|
100
|
+
S = Show comprehensive System info (system, CPU, filesystem, latest dmesg messages)
|
100
101
|
|
101
102
|
COPYRIGHT: Geir Isene, 2020-3. No rights reserved. See http://isene.com for more.
|
102
103
|
HELPTEXT
|
@@ -179,7 +180,8 @@ begin # BASIC SETUP
|
|
179
180
|
## These should not be set by user in .rtfm.conf
|
180
181
|
@directory = {} # Initialize the directory hash for remembering directories visited
|
181
182
|
@searched = "" # Initialize the active searched for items
|
182
|
-
@lsfiles = "" # File types to show (initially set to all file types
|
183
|
+
@lsfiles = "" # File types to show (initially set to all file types) - not saved on exit
|
184
|
+
@lsmatch = "" # Files to match (initially set to matching all files) - not saved on exit
|
183
185
|
@index = 0 # Set chosen item to first on startup
|
184
186
|
@marks["'"] = Dir.pwd
|
185
187
|
## File type recognizers
|
@@ -430,7 +432,7 @@ def main_getkey # GET KEY FROM USER
|
|
430
432
|
Dir.chdir
|
431
433
|
@w_r.update = true
|
432
434
|
@w_b.update = true
|
433
|
-
when '
|
435
|
+
when '>' # Follow symlink
|
434
436
|
@directory[Dir.pwd] = @selected # Store this directory before leaving
|
435
437
|
mark_latest
|
436
438
|
if File.symlink?(@selected)
|
@@ -682,11 +684,15 @@ def main_getkey # GET KEY FROM USER
|
|
682
684
|
getch
|
683
685
|
@break = true
|
684
686
|
# ADDITIONAL COMMANDS
|
685
|
-
when '
|
687
|
+
when 'f' # Filter out filetypes not matching @lsfiles
|
686
688
|
loop do
|
687
689
|
@lsfiles = w_b_getstr("Filetype(s) to show: ", @lsfiles)
|
688
690
|
break if @lsfiles.match(/^$|\w+(,\w+)*$/)
|
689
691
|
end
|
692
|
+
w_b_info(nil)
|
693
|
+
when 'F' # Filter out files not matching @lsmatch
|
694
|
+
@lsmatch = w_b_getstr("Files will match RegEx: ", @lsmatch)
|
695
|
+
w_b_info(nil)
|
690
696
|
when '/' # Get search string to mark items that match the input
|
691
697
|
@w_b.nohistory = true
|
692
698
|
@searched = w_b_getstr("/ ", "")
|
@@ -823,6 +829,31 @@ def mark_latest
|
|
823
829
|
@marks["1"] = @marks["'"]
|
824
830
|
@marks["'"] = Dir.pwd
|
825
831
|
end
|
832
|
+
def get_files(win) # The core of the directory listings
|
833
|
+
ls_cmd = "ls #{@lsbase} #{@lsall} #{@lsorder} #{@lsinvert} #{@lsuser}" # Get files in current directory
|
834
|
+
ls_cmd += @selected_safe if win == "right"
|
835
|
+
@files = `#{ls_cmd} 2>/dev/null`.split("\n")
|
836
|
+
ls_cmd += " -H " if win == "right"
|
837
|
+
ls_cmd += %q[ -lhgG --time-style="long-iso" 2>/dev/null | awk '{printf "%s%12s%6s%6s%5s", $1,$4,$5,$3,$2 "\n"}']
|
838
|
+
@fspes = `#{ls_cmd} 2>/dev/null`.split("\n").drop(1)
|
839
|
+
if @lsfiles != "" or @lsmatch != ""
|
840
|
+
lsf = @lsfiles.split(",").map! {|e| e.strip}
|
841
|
+
dir_cmd = "ls -d "
|
842
|
+
dir_cmd += @selected_safe + "/" if win == "right"
|
843
|
+
dir_cmd += "*/"
|
844
|
+
dirs = `#{dir_cmd} 2>/dev/null`.split("/\n")
|
845
|
+
dirs.map!{|d| d.sub!(/.*\//, '')} if win == "right"
|
846
|
+
@files = @files - dirs
|
847
|
+
@fspes = @fspes - dirs
|
848
|
+
@files.select! {|f| lsf.any? {|l| File.extname(f) == ".#{l}"}} if @lsfiles != ""
|
849
|
+
@fspes.select! {|f| lsf.any? {|l| File.extname(f) == ".#{l}"}} if @lsfiles != ""
|
850
|
+
@files.select! {|f| f =~ /#{@lsmatch}/} if @lsmatch != ""
|
851
|
+
@fspes.select! {|f| f =~ /#{@lsmatch}/} if @lsmatch != ""
|
852
|
+
@files = dirs + @files
|
853
|
+
@fspes = dirs + @fspes
|
854
|
+
@w_r.update = true
|
855
|
+
end
|
856
|
+
end
|
826
857
|
# TOP WINDOW FUNCTIONS
|
827
858
|
def w_t_info # SHOW INFO IN @w_t
|
828
859
|
text = " " + ENV['USER'].to_s + "@" + `hostname 2>/dev/null`.to_s.chop + ": " + Dir.pwd + "/"
|
@@ -1002,10 +1033,7 @@ def w_r_show # SHOW CONTENTS IN THE RIGHT WINDOW
|
|
1002
1033
|
if @w_r.pager > 0
|
1003
1034
|
pager_show
|
1004
1035
|
elsif File.directory?(@selected)
|
1005
|
-
|
1006
|
-
@files = `#{ls_cmd} 2>/dev/null`.split("\n")
|
1007
|
-
ls_cmd += %q[ -lhgGH --time-style="long-iso" 2>/dev/null | awk '{printf "%s%12s%6s%6s%5s", $1,$4,$5,$3,$2 "\n"}']
|
1008
|
-
@fspes = `#{ls_cmd} 2>/dev/null`.split("\n").drop(1)
|
1036
|
+
get_files("right")
|
1009
1037
|
list_dir(false)
|
1010
1038
|
# TEXT
|
1011
1039
|
elsif File.read(@selected).force_encoding("UTF-8").valid_encoding? and @w_r.pager == 0
|
@@ -1222,10 +1250,16 @@ end
|
|
1222
1250
|
# BOTTOM WINDOW FUNCTIONS
|
1223
1251
|
def w_b_info(info) # SHOW INFO IN @W_B
|
1224
1252
|
@w_b.clr
|
1253
|
+
@w_b.fg, @w_b.bg = 250, 238
|
1225
1254
|
if info == nil
|
1226
1255
|
info = ": for command (use @s for selected item, @t for tagged items) - press ? for help"
|
1227
|
-
info = "Showing only
|
1228
|
-
info = "Showing only file
|
1256
|
+
info = "Showing only files matching '#{@lsmatch}'" if @lsmatch != ""
|
1257
|
+
info = "Showing only file type '#{@lsfiles}'" if @lsfiles != ""
|
1258
|
+
info = "Showing only file types '#{@lsfiles}'" if @lsfiles =~ /,/
|
1259
|
+
info += " and only files matching '#{@lsmatch}'" if @lsfiles != "" and @lsmatch != ""
|
1260
|
+
@w_b.fg, @w_b.bg = 250, 88 if @lsfiles != ""
|
1261
|
+
@w_b.fg, @w_b.bg = 250, 21 if @lsmatch != ""
|
1262
|
+
@w_b.fg, @w_b.bg = 250, 55 if @lsfiles != "" and @lsmatch != ""
|
1229
1263
|
end
|
1230
1264
|
info = info[1..(@w_b.maxx - 3)] + "…" if info.length + 3 > @w_b.maxx
|
1231
1265
|
info += " " * (@w_b.maxx - info.length) if info.length < @w_b.maxx
|
@@ -1416,6 +1450,7 @@ loop do # OUTER LOOP - CATCHING REFRESHES VIA 'r'
|
|
1416
1450
|
@w_p.refresh
|
1417
1451
|
@w_t.fg, @w_t.bg = 232, 249
|
1418
1452
|
@w_t.attr = Curses::A_BOLD
|
1453
|
+
@w_b.fg, @w_b.bg = 250, 238
|
1419
1454
|
@w_b.update = true
|
1420
1455
|
@w_r.update = true
|
1421
1456
|
@w_r.pager = 0
|
@@ -1429,25 +1464,13 @@ loop do # OUTER LOOP - CATCHING REFRESHES VIA 'r'
|
|
1429
1464
|
@change = true
|
1430
1465
|
@change_tag = true # For future need to force @change
|
1431
1466
|
loop do # INNER, CORE LOOP
|
1432
|
-
@w_b.fg, @w_b.bg = 250, 238
|
1433
|
-
@w_b.fg, @w_b.bg = 250, 88 if @lsfiles != ""
|
1434
1467
|
@w_r.text = ""
|
1435
1468
|
begin # Jump to home dir if current dir is externally removed
|
1436
1469
|
Dir.pwd
|
1437
1470
|
rescue
|
1438
1471
|
Dir.chdir
|
1439
1472
|
end
|
1440
|
-
|
1441
|
-
lsf = lsf.join(" ")
|
1442
|
-
ls_cmd = "ls #{@lsbase} #{@lsall} #{@lsorder} #{@lsinvert} #{@lsuser} #{lsf}" # Get files in current directory
|
1443
|
-
@files = `#{ls_cmd} 2>/dev/null`.split("\n")
|
1444
|
-
ls_cmd += %q[ -lhgG --time-style="long-iso" 2>/dev/null | awk '{printf "%s%12s%6s%6s%5s", $1,$4,$5,$3,$2 "\n"}']
|
1445
|
-
@fspes = `#{ls_cmd} 2>/dev/null`.split("\n").drop(1)
|
1446
|
-
if @lsfiles != ""
|
1447
|
-
dirs = `ls -d */`.split("/\n")
|
1448
|
-
@files = dirs + @files
|
1449
|
-
@fspes = dirs + @fspes
|
1450
|
-
end
|
1473
|
+
get_files("left")
|
1451
1474
|
if Dir.pwd != dir_old
|
1452
1475
|
if @directory.key?(Dir.pwd)
|
1453
1476
|
@selected = @directory[Dir.pwd]
|
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: '2.
|
4
|
+
version: '2.3'
|
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-03-
|
11
|
+
date: 2023-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: curses
|
@@ -47,7 +47,8 @@ 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 2.
|
50
|
+
other features. New in 2.2: Better notification when files are filtered with ''f''
|
51
|
+
or ''F'''
|
51
52
|
email: g@isene.com
|
52
53
|
executables:
|
53
54
|
- rtfm
|