rtfm-filemanager 1.3.4 → 1.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/bin/rtfm +61 -27
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc3e48bb0ada386807c65a545d611fce279e6bf3fb59930321966f2930771e6c
|
4
|
+
data.tar.gz: 5291689c682b4a1330b22e8f29795d1a306fe5a2b37472b6dfab0900da48da0f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 252cd0070e118855a332d27c6e4fbb46dc528b337de47f7578a039c237be897991b0d154fdf9a12f45f26c5e6d48043f2a4f4501d9651a1f1766bce302eda0ad
|
7
|
+
data.tar.gz: 5fdc7a20442d6517f644bfb68aa8a9b5f6275afca1e620fe409ba0cc3f0ad39885c64f9ee4ddd426bcedf39d91b23fb4a82ac563cfe2e7d1f39828c6661cafc6
|
data/bin/rtfm
CHANGED
@@ -188,7 +188,7 @@ begin # BASIC SETUP
|
|
188
188
|
end
|
189
189
|
end
|
190
190
|
class Curses::Window # CLASS EXTENSION
|
191
|
-
attr_accessor :fg, :bg, :attr, :text, :update, :pager, :pager_more, :pager_cmd, :locate, :nohistory
|
191
|
+
attr_accessor :fg, :bg, :attr, :text, :update, :pager, :pager_more, :pager_cmd, :locate, :nohistory
|
192
192
|
# General extensions (see https://github.com/isene/Ruby-Curses-Class-Extension)
|
193
193
|
def clr
|
194
194
|
self.setpos(0, 0)
|
@@ -228,12 +228,12 @@ def get_ls_color(type) # GET THE COLOR FOR THE FILETYPE FROM IMPORTED LS_COLORS
|
|
228
228
|
return color.to_i, bold
|
229
229
|
end
|
230
230
|
def color_parse(input) # PARSE ANSI COLOR SEQUENCES
|
231
|
-
input.gsub!( /\e\[\d;38;5;(\d+)m/, '
|
232
|
-
input.gsub!( /\e\[38;5;(\d+)m/, '
|
231
|
+
input.gsub!( /\e\[\d;38;5;(\d+);*(\d*)m/, '¤¤\1¤¤\2¤¤')
|
232
|
+
input.gsub!( /\e\[38;5;(\d+);*(\d*)m/, '¤¤\1¤¤\2¤¤')
|
233
233
|
input.gsub!( /\e\[0m/, "\t")
|
234
|
-
color_array = input.split("
|
234
|
+
color_array = input.split("¤¤")
|
235
235
|
color_array = color_array.drop(1)
|
236
|
-
output = color_array.each_slice(
|
236
|
+
output = color_array.each_slice(3).to_a
|
237
237
|
return output
|
238
238
|
end
|
239
239
|
def getchr # PROCESS KEY PRESSES
|
@@ -276,6 +276,7 @@ def main_getkey # GET KEY FROM USER
|
|
276
276
|
case chr
|
277
277
|
# BASIC KEYS
|
278
278
|
when '?' # Show helptext in right window
|
279
|
+
@w_r.fg = 249
|
279
280
|
w_r_info(@help)
|
280
281
|
@w_b.update = true
|
281
282
|
when 'r' # Refresh all windows
|
@@ -367,6 +368,7 @@ def main_getkey # GET KEY FROM USER
|
|
367
368
|
@w_b.update = true
|
368
369
|
when 'M' # Show marks
|
369
370
|
@marks = @marks.sort.to_h
|
371
|
+
@w_r.fg = 147
|
370
372
|
marks_info
|
371
373
|
@w_r.update = false
|
372
374
|
@w_b.update = true
|
@@ -440,6 +442,7 @@ def main_getkey # GET KEY FROM USER
|
|
440
442
|
@w_r.update = true
|
441
443
|
@w_b.update = true
|
442
444
|
when 'T' # Show tagged list
|
445
|
+
@w_r.fg = 196
|
443
446
|
tagged_info
|
444
447
|
@w_r.update = false
|
445
448
|
@w_b.update = true
|
@@ -524,6 +527,7 @@ def main_getkey # GET KEY FROM USER
|
|
524
527
|
when 'O' # Show the Ordering in the bottom window (the full ls command)
|
525
528
|
w_b_info(" Full 'ls' command: ls <@s> #{@lsbase} #{@lsall} #{@lsorder} #{@lsinvert} #{@lsuser}")
|
526
529
|
when 'G' # Git status for selected item or current dir
|
530
|
+
@w_r.fg = 214
|
527
531
|
if File.exist?(".git")
|
528
532
|
w_r_info(`git status 2>/dev/null`)
|
529
533
|
else
|
@@ -532,6 +536,7 @@ def main_getkey # GET KEY FROM USER
|
|
532
536
|
@w_r.update = false
|
533
537
|
@w_b.update = true
|
534
538
|
when 'H' # Compare with previous hash status or write hash status if no existing hash
|
539
|
+
@w_r.fg = 213
|
535
540
|
hashcmd = "\(find #{Dir.pwd} -type f -print0 | sort -z | xargs -0 sha1sum; find #{Dir.pwd}"\
|
536
541
|
" \\( -type f -o -type d \\) -print0 | sort -z | xargs -0 stat -c '%n %a'\) | sha1sum | cut -c -40"
|
537
542
|
begin
|
@@ -556,20 +561,27 @@ def main_getkey # GET KEY FROM USER
|
|
556
561
|
@w_b.update = false
|
557
562
|
when 'S' # Show comprehensive system info
|
558
563
|
@w_r.pager_cmd = ""
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
564
|
+
uname = `uname -o`.chop + " "
|
565
|
+
uname += `uname -r`.chop + " "
|
566
|
+
uname += `uname -v`.chop + " "
|
567
|
+
uname += `uname -p` + "\n"
|
568
|
+
text = [[253, 1, uname]]
|
569
|
+
mem = `free -h` + "\n"
|
570
|
+
text += [[229, 0, mem]]
|
571
|
+
cpu = "CPUs = " + `nproc`.chop + " "
|
572
|
+
cpuinfo = `lscpu`
|
573
|
+
cpu += cpuinfo[/^.*Model name:\s*(.*)/, 1] + " "
|
574
|
+
cpu += "Max: " + cpuinfo[/^.*CPU max MHz:\s*(.*)/, 1][/(.*),.*/, 1] + "MHz "
|
575
|
+
cpu += "Min: " + cpuinfo[/^.*CPU min MHz:\s*(.*)/, 1][/(.*),.*/, 1] + "MHz\n\n"
|
576
|
+
text += [[154, 0, cpu]]
|
577
|
+
ps = `ps -eo comm,pid,user,pcpu,pmem,stat --sort -pcpu,-pmem | head` + "\n"
|
578
|
+
text += [[195, 0, ps]]
|
579
|
+
disk = `df -H | head -8`
|
580
|
+
text += [[172, 0, disk]]
|
581
|
+
dmesg = "\nDMESG:\n"
|
582
|
+
dmesg += `dmesg | tail -6`
|
583
|
+
text += [[219, 0, dmesg]]
|
584
|
+
@w_r.text= ansifix(text)
|
573
585
|
pager_start
|
574
586
|
pager_show
|
575
587
|
@w_r.update = false
|
@@ -691,6 +703,16 @@ def conf_write
|
|
691
703
|
end
|
692
704
|
File.write(Dir.home+'/.rtfm.conf', conf)
|
693
705
|
end
|
706
|
+
def ansifix(text) # Format [[fg, attr, text]]
|
707
|
+
output = ""
|
708
|
+
text.each do |e|
|
709
|
+
ansi = "\e[38;5;#{e[0]}"
|
710
|
+
ansi += ";1" if e[1] == 1
|
711
|
+
ansi += "m"
|
712
|
+
output += ansi + e[2].gsub(/\n/, "\n#{ansi}")
|
713
|
+
end
|
714
|
+
return output
|
715
|
+
end
|
694
716
|
# TOP WINDOW FUNCTIONS
|
695
717
|
def w_t_info # SHOW INFO IN @w_t
|
696
718
|
text = " " + ENV['USER'].to_s + "@" + `hostname 2>/dev/null`.to_s.chop + ": " + Dir.pwd + "/"
|
@@ -951,7 +973,7 @@ def w_r_info(info) # SHOW INFO IN THE RIGHT WINDOW
|
|
951
973
|
image_show("clear") if @image; @image = false
|
952
974
|
end
|
953
975
|
def marks_info # SHOW MARKS IN RIGHT WINDOW
|
954
|
-
info = "
|
976
|
+
info = "MARKS:\n"
|
955
977
|
unless @marks.empty?
|
956
978
|
@marks.each do |mark, dir|
|
957
979
|
info += "#{mark} = #{dir}\n"
|
@@ -962,19 +984,21 @@ def marks_info # SHOW MARKS IN RIGHT WINDOW
|
|
962
984
|
w_r_info(info)
|
963
985
|
end
|
964
986
|
def tagged_info # SHOW THE LIST OF TAGGED ITEMS IN @w_r
|
965
|
-
info = "
|
987
|
+
info = "TAGGED:\n"
|
966
988
|
@tagged.empty? ? info += "(None)" : info += @tagged.join("\n")
|
967
989
|
w_r_info(info)
|
968
990
|
end
|
969
|
-
def syntax_highlight(input) #
|
991
|
+
def syntax_highlight(input) # SYNTAX HIGHLIGHTING FROM ANSI COLOR CODES
|
970
992
|
color_ary = color_parse(input)
|
971
993
|
color_ary.each do | pair |
|
972
994
|
begin
|
973
995
|
fg = pair[0].to_i
|
974
|
-
|
996
|
+
atr = pair[1].to_i
|
997
|
+
atr == 1 ? atr = Curses::A_BOLD : atr = 0
|
998
|
+
text = pair[2]
|
975
999
|
text.gsub!(/\t/, '')
|
976
1000
|
init_pair(fg, fg, 0)
|
977
|
-
@w_r.attron(color_pair(fg)) { @w_r << text }
|
1001
|
+
@w_r.attron(color_pair(fg) | atr) { @w_r << text }
|
978
1002
|
rescue
|
979
1003
|
end
|
980
1004
|
end
|
@@ -1028,10 +1052,17 @@ def pager_show # SHOW THE CURRENT PAGE CONTENT
|
|
1028
1052
|
end_l = beg_l + @w_r.maxy - 2
|
1029
1053
|
input = @w_r.text.lines[beg_l..end_l].join() + "\n"
|
1030
1054
|
input.lines.count > @w_r.maxy - 2 ? @w_r.pager_more = true : @w_r.pager_more = false
|
1031
|
-
if @w_r.pager_cmd.match(/batcat/)
|
1055
|
+
#if @w_r.pager_cmd.match(/batcat/)
|
1056
|
+
if @w_r.text.match(/^\e\[/)
|
1032
1057
|
syntax_highlight(input)
|
1033
1058
|
else
|
1034
|
-
@w_r
|
1059
|
+
if @w_r.fg == nil
|
1060
|
+
init_pair(255, 255, 0)
|
1061
|
+
@w_r.fg = 255
|
1062
|
+
else
|
1063
|
+
init_pair(@w_r.fg, @w_r.fg, 0)
|
1064
|
+
end
|
1065
|
+
@w_r.attron(color_pair(@w_r.fg)) { @w_r << input }
|
1035
1066
|
end
|
1036
1067
|
(@w_r.maxy - @w_r.cury).times {@w_r.deleteln()} # Clear to bottom of window
|
1037
1068
|
pager_add_markers
|
@@ -1294,7 +1325,10 @@ loop do # OUTER LOOP - CATCHING REFRESHES VIA 'r'
|
|
1294
1325
|
@w_l.setpos(0,0)
|
1295
1326
|
list_dir(true)
|
1296
1327
|
@w_l.refresh
|
1297
|
-
|
1328
|
+
if @w_r.update and @preview
|
1329
|
+
w_r_show
|
1330
|
+
@w_r.fg = 255
|
1331
|
+
end
|
1298
1332
|
Curses.curs_set(1) # Clear residual cursor
|
1299
1333
|
Curses.curs_set(0) # ...from editing files
|
1300
1334
|
@tag = false # Clear tag pattern
|
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: 1.3.
|
4
|
+
version: 1.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: 2021-10-
|
11
|
+
date: 2021-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: curses
|
@@ -33,8 +33,7 @@ dependencies:
|
|
33
33
|
description: 'A full featured terminal browser with syntax highlighted files, images
|
34
34
|
shown in the terminal, videos thumbnailed, etc. You can bookmark and jump around
|
35
35
|
easily, delete, rename, copy, symlink and move files. RTFM has a a wide range of
|
36
|
-
other features. New in 1.3.
|
37
|
-
(system, CPU, filesystem, latest dmesg messages)'
|
36
|
+
other features. New in 1.3.8: Better system info (via the key ''S'')'
|
38
37
|
email: g@isene.com
|
39
38
|
executables:
|
40
39
|
- rtfm
|