rtfm-filemanager 1.3.5 → 1.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/rtfm +44 -25
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5c18ed2d6400377fdf9e2acf29f0ca8e4cee53fdc96fc5db49f5e9be6ed5a43
|
4
|
+
data.tar.gz: 6596098c323336814fd4fd0cdb147441ff70479580cbc6f6a441fa4f551be485
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90b2cc8d115449ca2d66a92e053c33c956dad083067dcef5f750476c8a8ae8c0a6c36592da11ad29aacd831af1fc59b39a09bda2913a836354763da7f75eaba8
|
7
|
+
data.tar.gz: e1dead5ecb7189b0dedc7a48eeeab77b29b810f699bbe39f21d011115c70f63f1841b81133cb3c70b6e4d2187bc583d1e9338f150485b8ae511c6d95c79350ec
|
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+)m/, '¤¤\1¤¤')
|
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
|
@@ -561,22 +561,28 @@ def main_getkey # GET KEY FROM USER
|
|
561
561
|
@w_b.update = false
|
562
562
|
when 'S' # Show comprehensive system info
|
563
563
|
@w_r.pager_cmd = ""
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
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 "
|
576
|
+
cpu += "\n\n"
|
577
|
+
text += [[154, 0, cpu]]
|
578
|
+
disk = `df -H`
|
579
|
+
text += [[123, 0, disk]]
|
580
|
+
dmesg = "\nDMESG:\n"
|
581
|
+
dmesg += `dmesg | tail -10`
|
582
|
+
text += [[213, 0, dmesg]]
|
583
|
+
@w_r.text= ansifix(text)
|
584
|
+
pager_start
|
585
|
+
pager_show
|
580
586
|
@w_r.update = false
|
581
587
|
# RIGHT PANE
|
582
588
|
when 'ENTER' # Refresh right pane
|
@@ -696,6 +702,16 @@ def conf_write
|
|
696
702
|
end
|
697
703
|
File.write(Dir.home+'/.rtfm.conf', conf)
|
698
704
|
end
|
705
|
+
def ansifix(text) # Format [[fg, attr, text]]
|
706
|
+
output = ""
|
707
|
+
text.each do |e|
|
708
|
+
ansi = "\e[38;5;#{e[0]}"
|
709
|
+
ansi += ";1" if e[1] == 1
|
710
|
+
ansi += "m"
|
711
|
+
output += ansi + e[2].gsub(/\n/, "\n#{ansi}")
|
712
|
+
end
|
713
|
+
return output
|
714
|
+
end
|
699
715
|
# TOP WINDOW FUNCTIONS
|
700
716
|
def w_t_info # SHOW INFO IN @w_t
|
701
717
|
text = " " + ENV['USER'].to_s + "@" + `hostname 2>/dev/null`.to_s.chop + ": " + Dir.pwd + "/"
|
@@ -971,15 +987,17 @@ def tagged_info # SHOW THE LIST OF TAGGED ITEMS IN @w_r
|
|
971
987
|
@tagged.empty? ? info += "(None)" : info += @tagged.join("\n")
|
972
988
|
w_r_info(info)
|
973
989
|
end
|
974
|
-
def syntax_highlight(input) #
|
990
|
+
def syntax_highlight(input) # SYNTAX HIGHLIGHTING FROM ANSI COLOR CODES
|
975
991
|
color_ary = color_parse(input)
|
976
992
|
color_ary.each do | pair |
|
977
993
|
begin
|
978
994
|
fg = pair[0].to_i
|
979
|
-
|
995
|
+
atr = pair[1].to_i
|
996
|
+
atr == 1 ? atr = Curses::A_BOLD : atr = 0
|
997
|
+
text = pair[2]
|
980
998
|
text.gsub!(/\t/, '')
|
981
999
|
init_pair(fg, fg, 0)
|
982
|
-
@w_r.attron(color_pair(fg)) { @w_r << text }
|
1000
|
+
@w_r.attron(color_pair(fg) | atr) { @w_r << text }
|
983
1001
|
rescue
|
984
1002
|
end
|
985
1003
|
end
|
@@ -1033,7 +1051,8 @@ def pager_show # SHOW THE CURRENT PAGE CONTENT
|
|
1033
1051
|
end_l = beg_l + @w_r.maxy - 2
|
1034
1052
|
input = @w_r.text.lines[beg_l..end_l].join() + "\n"
|
1035
1053
|
input.lines.count > @w_r.maxy - 2 ? @w_r.pager_more = true : @w_r.pager_more = false
|
1036
|
-
if @w_r.pager_cmd.match(/batcat/)
|
1054
|
+
#if @w_r.pager_cmd.match(/batcat/)
|
1055
|
+
if @w_r.text.match(/^\e\[/)
|
1037
1056
|
syntax_highlight(input)
|
1038
1057
|
else
|
1039
1058
|
if @w_r.fg == nil
|
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.6
|
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-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: curses
|
@@ -33,8 +33,8 @@ 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
|
-
|
36
|
+
other features. New in 1.3.6: Created a better ANSI color code parser and prettified
|
37
|
+
system info (via key ''S'')'
|
38
38
|
email: g@isene.com
|
39
39
|
executables:
|
40
40
|
- rtfm
|