rtfm-filemanager 3.11 → 3.14
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 +72 -53
- 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: e77bc5690f12f9c61ea2dd2df952abbeef8b3395dbee1b849695064d9cec841f
|
|
4
|
+
data.tar.gz: 9c5e0c83c062bc41b75213092f8ae248637a515ac6c43ae11e1528e827966db2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: afb42ff066cbb903e0e3ce8952077fa9ca5c4dcfd5727c9cc4ee3ca0c424cc7bb57e8c18888c10387d1698447f66abf682e5ec3973445e3bd9f962dcc340b7e7
|
|
7
|
+
data.tar.gz: efd38391d2677563495dd128ea817dcce6a69aa58305515263976a1879c01a6f6df58226bdc241ec2b4db3544a823bf0f921ee0e8a1acd79751f6f7dd3a0a07f
|
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.14"
|
|
18
18
|
|
|
19
19
|
# PRELIMINARIES
|
|
20
20
|
@help = <<HELPTEXT
|
|
@@ -211,42 +211,43 @@ begin # BASIC SETUP
|
|
|
211
211
|
|
|
212
212
|
# INITIALIZE VARIABLES
|
|
213
213
|
## These can be set by user in .rtfm.conf
|
|
214
|
-
@lsbase
|
|
215
|
-
@lslong
|
|
216
|
-
@lsall
|
|
217
|
-
@lsorder
|
|
218
|
-
@lsinvert
|
|
219
|
-
@lsuser
|
|
220
|
-
@width
|
|
221
|
-
@history
|
|
222
|
-
@
|
|
223
|
-
@
|
|
224
|
-
@
|
|
225
|
-
@
|
|
214
|
+
@lsbase = "--group-directories-first" # Basic ls setup
|
|
215
|
+
@lslong = false # Set short form ls (toggled by pressing "l")
|
|
216
|
+
@lsall = "" # Set "ls -a" to false (toggled by pressing "a" - sets it to "-a")
|
|
217
|
+
@lsorder = "" # Change the order/sorting by pressing 'o' (circular toggle)
|
|
218
|
+
@lsinvert = "" # Set to "-r" to reverse/invert sorting order
|
|
219
|
+
@lsuser = "" # Set this variable in .rtfm.conf to any 'ls' switch you want to customize directory listings
|
|
220
|
+
@width = 4 # Set width of the left pane to the default ⅓ of the terminal width
|
|
221
|
+
@history = [] # Initialize the command line history array
|
|
222
|
+
@rubyhistory = [] # Initialize the command line history array for ruby commands
|
|
223
|
+
@border = false
|
|
224
|
+
@preview = true
|
|
225
|
+
@runmailcap = false # Set to 'true' in .rtfm.conf if you want to use run-mailcap instead of xdg-open
|
|
226
|
+
@batuse = true # Use batcat for syntax highlighting
|
|
226
227
|
## These are automatically written on exit
|
|
227
|
-
@marks
|
|
228
|
-
@hash
|
|
229
|
-
@tagged
|
|
228
|
+
@marks = {} # Initialize (book)marks hash
|
|
229
|
+
@hash = {} # Initialize the sha directory hashing
|
|
230
|
+
@tagged = [] # Initialize the tagged array - for collecting all tagged items
|
|
230
231
|
## These should not be set by user in .rtfm.conf
|
|
231
|
-
@directory
|
|
232
|
-
@searched
|
|
233
|
-
@lsfiles
|
|
234
|
-
@lsmatch
|
|
235
|
-
@index
|
|
236
|
-
@cont
|
|
237
|
-
@tagsize
|
|
238
|
-
@navi
|
|
239
|
-
@marks["'"]
|
|
232
|
+
@directory = {} # Initialize the directory hash for remembering directories visited
|
|
233
|
+
@searched = "" # Initialize the active searched for items
|
|
234
|
+
@lsfiles = "" # File types to show (initially set to all file types) - not saved on exit
|
|
235
|
+
@lsmatch = "" # Files to match (initially set to matching all files) - not saved on exit
|
|
236
|
+
@index = 0 # Set chosen item to first on startup
|
|
237
|
+
@cont = ""
|
|
238
|
+
@tagsize = 0
|
|
239
|
+
@navi = ""
|
|
240
|
+
@marks["'"] = Dir.pwd
|
|
240
241
|
## File type recognizers
|
|
241
|
-
@imagefile
|
|
242
|
-
@pptfile
|
|
243
|
-
@xlsfile
|
|
244
|
-
@docfile
|
|
245
|
-
@docxfile
|
|
246
|
-
@xlsxfile
|
|
247
|
-
@pptxfile
|
|
248
|
-
@oolofile
|
|
249
|
-
@pdffile
|
|
242
|
+
@imagefile = /\.jpg$|\.JPG$|\.jpeg$|\.png$|\.bmp$|\.gif$|\.tif$|\.tiff$/
|
|
243
|
+
@pptfile = /\.ppt$/
|
|
244
|
+
@xlsfile = /\.xls$/
|
|
245
|
+
@docfile = /\.doc$/
|
|
246
|
+
@docxfile = /\.docx$/
|
|
247
|
+
@xlsxfile = /\.xlsx$/
|
|
248
|
+
@pptxfile = /\.pptx$/
|
|
249
|
+
@oolofile = /\.odt$|\.odc$|\.odp$|\.odg$/
|
|
250
|
+
@pdffile = /\.pdf$|\.ps$/
|
|
250
251
|
## Get variables from config file (written back to .rtf.conf upon exit via 'q')
|
|
251
252
|
if File.exist?(Dir.home+'/.rtfm.conf')
|
|
252
253
|
load(Dir.home+'/.rtfm.conf')
|
|
@@ -876,7 +877,7 @@ def main_getkey # GET KEY FROM USER
|
|
|
876
877
|
@break = true
|
|
877
878
|
when '@' # Enter "Ruby debug"
|
|
878
879
|
@w_b.nohistory = false
|
|
879
|
-
cmd = w_b_getstr("◆ ", "")
|
|
880
|
+
cmd = w_b_getstr("◆ ", "", true)
|
|
880
881
|
@w_b.clr
|
|
881
882
|
@w_b.refresh
|
|
882
883
|
@w_b.update = true
|
|
@@ -884,8 +885,8 @@ def main_getkey # GET KEY FROM USER
|
|
|
884
885
|
info = "Command: #{cmd}\n\n"
|
|
885
886
|
begin
|
|
886
887
|
info += eval(cmd).to_s
|
|
887
|
-
rescue
|
|
888
|
-
info += "Error: #{
|
|
888
|
+
rescue Exception => err
|
|
889
|
+
info += "Error: #{err.inspect}"
|
|
889
890
|
end
|
|
890
891
|
w_r_info(info)
|
|
891
892
|
@w_r.update = false
|
|
@@ -912,6 +913,10 @@ def conf_write
|
|
|
912
913
|
conf += "@hash = #{@hash}\n"
|
|
913
914
|
conf.sub!(/^@tagged.*\[.*\]\n/, "")
|
|
914
915
|
conf += "@tagged = #{@tagged}\n"
|
|
916
|
+
conf.sub!(/^@history.*\[.*\]\n/, "")
|
|
917
|
+
conf += "@history = #{@history}\n"
|
|
918
|
+
conf.sub!(/^@rubyhistory.*\[.*\]\n/, "")
|
|
919
|
+
conf += "@rubyhistory = #{@rubyhistory}\n"
|
|
915
920
|
if @write_conf_all
|
|
916
921
|
conf.sub!(/^@lslong.*\n/, "")
|
|
917
922
|
conf += "@lslong = #{@lslong}\n"
|
|
@@ -1128,7 +1133,7 @@ def copy_move_link(type) # COPY OR MOVE TAGGED ITEMS (COPY IF "keep == true")
|
|
|
1128
1133
|
FileUtils.ln_s(item, dest)
|
|
1129
1134
|
w_b_info(" Item(s) symlinked here.")
|
|
1130
1135
|
end
|
|
1131
|
-
rescue
|
|
1136
|
+
rescue Exception => err
|
|
1132
1137
|
w_b_info(err.to_s)
|
|
1133
1138
|
end
|
|
1134
1139
|
end
|
|
@@ -1222,16 +1227,19 @@ def w_r_doc # GET FULL CONTENT TO PAGE
|
|
|
1222
1227
|
@w_r << @w_r.text
|
|
1223
1228
|
end
|
|
1224
1229
|
def w_r_info(info) # SHOW INFO IN THE RIGHT WINDOW
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1230
|
+
begin
|
|
1231
|
+
image_show("clear") if @image; @image = false
|
|
1232
|
+
@w_r.clr
|
|
1233
|
+
@w_r.refresh
|
|
1234
|
+
w_r_width = Curses.cols - (Curses.cols * @width / 10) - 2
|
|
1235
|
+
info.gsub!(/(.{1,#{w_r_width}})( +|$\n?)|(.{1,#{w_r_width}})/, "\\1\\3\n")
|
|
1236
|
+
@w_r.text = info
|
|
1237
|
+
@w_r.pager_cmd = ""
|
|
1238
|
+
pager_start
|
|
1239
|
+
pager_show
|
|
1240
|
+
@w_r.update = false
|
|
1241
|
+
rescue
|
|
1242
|
+
end
|
|
1235
1243
|
end
|
|
1236
1244
|
def marks_info # SHOW MARKS IN RIGHT WINDOW
|
|
1237
1245
|
@w_r.fg = 183
|
|
@@ -1426,14 +1434,19 @@ def w_b_info(info) # SHOW INFO IN @W_B
|
|
|
1426
1434
|
@w_b.write
|
|
1427
1435
|
@w_b.update = false
|
|
1428
1436
|
end
|
|
1429
|
-
def w_b_getstr(pretext, text) # A SIMPLE READLINE-LIKE ROUTINE
|
|
1437
|
+
def w_b_getstr(pretext, text, ruby=false) # A SIMPLE READLINE-LIKE ROUTINE
|
|
1430
1438
|
Curses.curs_set(1)
|
|
1431
1439
|
Curses.echo
|
|
1432
1440
|
stk = 0
|
|
1433
|
-
@history.insert(stk, text)
|
|
1434
|
-
pos = @history[stk].length
|
|
1435
1441
|
chr = ""
|
|
1436
|
-
|
|
1442
|
+
if ruby
|
|
1443
|
+
@rubyhistory.insert(stk, text)
|
|
1444
|
+
@history_copy = @rubyhistory.map(&:clone)
|
|
1445
|
+
else
|
|
1446
|
+
@history.insert(stk, text)
|
|
1447
|
+
@history_copy = @history.map(&:clone)
|
|
1448
|
+
end
|
|
1449
|
+
pos = @history_copy[stk].length
|
|
1437
1450
|
while chr != "ENTER"
|
|
1438
1451
|
@w_b.setpos(0,0)
|
|
1439
1452
|
init_pair(250, 250, 238)
|
|
@@ -1544,11 +1557,14 @@ def w_b_getstr(pretext, text) # A SIMPLE READLINE-LIKE ROUTINE
|
|
|
1544
1557
|
end
|
|
1545
1558
|
curstr = @history_copy[stk]
|
|
1546
1559
|
@history_copy.shift if @w_b.nohistory
|
|
1547
|
-
@history.insert(0, @history_copy[stk])
|
|
1560
|
+
ruby ? @rubyhistory.insert(0, @history_copy[stk]) : @history.insert(0, @history_copy[stk])
|
|
1548
1561
|
unless @w_b.nohistory
|
|
1549
1562
|
@history.uniq!
|
|
1550
1563
|
@history.compact!
|
|
1551
1564
|
@history.delete("")
|
|
1565
|
+
@rubyhistory.uniq!
|
|
1566
|
+
@rubyhistory.compact!
|
|
1567
|
+
@rubyhistory.delete("")
|
|
1552
1568
|
end
|
|
1553
1569
|
Curses.curs_set(0)
|
|
1554
1570
|
Curses.noecho
|
|
@@ -1689,6 +1705,9 @@ loop do # OUTER LOOP - CATCHING REFRESHES VIA 'r'
|
|
|
1689
1705
|
break if Curses.cols != maxx or Curses.lines != maxy # break on terminal resize
|
|
1690
1706
|
break if @break # Break to outer loop, redrawing windows, if user hit 'r'
|
|
1691
1707
|
end
|
|
1708
|
+
rescue StandardError => err # Throw error nicely
|
|
1709
|
+
w_r_info(err)
|
|
1710
|
+
@w_r.update = false
|
|
1692
1711
|
ensure # On exit: close curses, clear terminal
|
|
1693
1712
|
@write_conf_all = false
|
|
1694
1713
|
conf_write if @write_conf # Write marks to config file
|
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.14'
|
|
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-
|
|
11
|
+
date: 2023-06-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: curses
|
|
@@ -47,7 +47,7 @@ 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.14: Better error handling.'
|
|
51
51
|
email: g@isene.com
|
|
52
52
|
executables:
|
|
53
53
|
- rtfm
|