rtfm-filemanager 1.3.0 → 1.3.4

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/rtfm +53 -14
  3. metadata +4 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f074d7e27f2d2eec77ff1d33aaf4e783e2bf7c4624aba2882e6edfea1f9eacd8
4
- data.tar.gz: 4a4a1b915e8ec445918b0ae774d67c798b6823b19ddc49ce1d92a49f229796a9
3
+ metadata.gz: 37417f8c791cc8efd9e6d9173f0408ebc6c4704bc5571efdbbda7f253835d79b
4
+ data.tar.gz: 9304a814ca2b6cd77ddc1cf19f172c8d3538bfee101a6fae19929226f78f9fb1
5
5
  SHA512:
6
- metadata.gz: 4086961612be3e5e2a3d9a3f39dba7cd6686fcf803a568215de2c535a06a044edd497370729bcb16314fdd707e8825aeb97e6c066fa322e2d8191afbac79b6dd
7
- data.tar.gz: 7970bcf40bf96f79d213f8787feafc66ec52c7693df5e580872830e3562ca9b3d5149eb2aa3ae47c14289ed4e37c5fc87fe695529d64fbe6e0c5e87fe978b5b8
6
+ metadata.gz: ebc13ae2087a0a412a0f933f62e87b68d4bc5df325902d0870176689882298d2e672e121e389ccab6dc6080ee56390729c951139512a0f03c6cd02fa7775d101
7
+ data.tar.gz: fe964dc5032cd8fff3fcf2f5b2ca6407fc305be811a988022510e61c1b6173408ee8333edc429dcaee45a551c89479d209bdbddbfacdee604497744ff5dafda3
data/bin/rtfm CHANGED
@@ -23,7 +23,8 @@ BASIC KEYS
23
23
  ? = Show this help text
24
24
  r = Refresh RTFM (recreates all windows. Use on terminal resize or when there is garbage somewhere)
25
25
  R = Reload configuration (~/.rtfm.conf)
26
- W = Write parameters to ~/.rtfm.conf (@lsall, @lslong, @border, @width, @preview, @tagged, @marks)
26
+ W = Write parameters to ~/.rtfm.conf
27
+ (@lsall, @lslong, @lsorder, @lsinvert, @border, @width, @preview, @tagged, @marks)
27
28
  q = Quit
28
29
  Q = QUIT (without writing changes to the config file)
29
30
 
@@ -71,6 +72,7 @@ DIRECTORY VIEWS
71
72
  G = Show git status for current directory
72
73
  H = Do a cryptographic hash of the current directory with subdirs
73
74
  If a previous hash was made, compare and report if there has been any change
75
+ S = Show comprehensive system info (system, CPU, filesystem, latest dmesg messages)
74
76
 
75
77
  RIGHT PANE
76
78
  ENTER = Refresh the right pane
@@ -122,6 +124,7 @@ begin # BASIC SETUP
122
124
  require 'fileutils'
123
125
  require 'io/console'
124
126
  require 'date'
127
+ require 'timeout'
125
128
  require 'curses'
126
129
  include Curses
127
130
 
@@ -551,6 +554,25 @@ def main_getkey # GET KEY FROM USER
551
554
  end
552
555
  @w_r.update = true
553
556
  @w_b.update = false
557
+ when 'S' # Show comprehensive system info
558
+ @w_r.pager_cmd = ""
559
+ @w_r.text = `uname -o`.chop + " "
560
+ @w_r.text += `uname -r`.chop + " "
561
+ @w_r.text += `uname -v`.chop + " "
562
+ @w_r.text += `uname -p` + "\n"
563
+ @w_r.text += `free -h` + "\n"
564
+ @w_r.text += "CPUs = " + `nproc`.chop + " "
565
+ cpuinfo = `lscpu`
566
+ @w_r.text += cpuinfo[/^.*Model name:\s*(.*)/, 1] + " "
567
+ @w_r.text += "Max: " + cpuinfo[/^.*CPU max MHz:\s*(.*)/, 1][/(.*),.*/, 1] + "MHz "
568
+ @w_r.text += "Min: " + cpuinfo[/^.*CPU min MHz:\s*(.*)/, 1][/(.*),.*/, 1] + "MHz "
569
+ @w_r.text += "\n\n"
570
+ @w_r.text += `df -H`
571
+ @w_r.text += "\nDMESG:\n"
572
+ @w_r.text += `dmesg | tail -10`
573
+ pager_start
574
+ pager_show
575
+ @w_r.update = false
554
576
  # RIGHT PANE
555
577
  when 'ENTER' # Refresh right pane
556
578
  @w_r.clr # First clear the window, then clear any previously showing image
@@ -625,7 +647,10 @@ def main_getkey # GET KEY FROM USER
625
647
  @w_r.pager = 0
626
648
  @w_r.pager_more = false
627
649
  end
628
- @w_r.update = true if dir != Dir.pwd
650
+ begin
651
+ @w_r.update = true if dir != Dir.pwd
652
+ rescue
653
+ end
629
654
  end
630
655
  def conf_write
631
656
  if File.exist?(Dir.home+'/.rtfm.conf')
@@ -644,6 +669,10 @@ def conf_write
644
669
  conf += "@lslong = #{@lslong}\n"
645
670
  conf.sub!(/^@lsall.*\n/, "")
646
671
  conf += "@lsall = \"#{@lsall}\"\n"
672
+ conf.sub!(/^@lsorder.*\n/, "")
673
+ conf += "@lsorder = \"#{@lsorder}\"\n"
674
+ conf.sub!(/^@lsinvert.*\n/, "")
675
+ conf += "@lsinvert = \"#{@lsinvert}\"\n"
647
676
  conf.sub!(/^@width.*\n/, "")
648
677
  conf += "@width = #{@width}\n"
649
678
  conf.sub!(/^@border.*\n/, "")
@@ -1169,17 +1198,19 @@ def w_b_exec(cmd) # EXECUTE COMMAND FROM @W_B
1169
1198
  return
1170
1199
  end
1171
1200
  begin
1172
- begin
1173
- @w_r.pager_cmd = "#{cmd} | batcat -n --color=always 2>/dev/null"
1174
- @w_r.text = `#{@w_r.pager_cmd} 2>/dev/null`
1175
- rescue
1176
- @w_r.text = `#{cmd} 2>/dev/null`
1177
- end
1178
- unless @w_r.text == "" or @w_r.text == nil
1179
- pager_start
1180
- pager_show
1181
- @w_r.update = false
1182
- end
1201
+ status = Timeout::timeout(5) {
1202
+ begin
1203
+ @w_r.pager_cmd = "#{cmd} | batcat -n --color=always 2>/dev/null"
1204
+ @w_r.text = `#{@w_r.pager_cmd} 2>/dev/null`
1205
+ rescue
1206
+ @w_r.text = `#{cmd} 2>/dev/null`
1207
+ end
1208
+ unless @w_r.text == "" or @w_r.text == nil
1209
+ pager_start
1210
+ pager_show
1211
+ @w_r.update = false
1212
+ end
1213
+ }
1183
1214
  rescue
1184
1215
  w_b_info(" Failed to execute command (#{cmd})")
1185
1216
  end
@@ -1222,6 +1253,11 @@ loop do # OUTER LOOP - CATCHING REFRESHES VIA 'r'
1222
1253
  @w_r.update = false
1223
1254
  end
1224
1255
  loop do # INNER, CORE LOOP
1256
+ begin # Jump to home dir if current dir is externally removed
1257
+ Dir.pwd
1258
+ rescue
1259
+ Dir.chdir
1260
+ end
1225
1261
  system("printf \"\033]0;RTFM: #{Dir.pwd}\007\"") # Set Window title to path
1226
1262
  ls_cmd = "ls #{@lsbase} #{@lsall} #{@lsorder} #{@lsinvert} #{@lsuser}" # Get files in current directory
1227
1263
  @files = `#{ls_cmd} 2>/dev/null`.split("\n")
@@ -1273,7 +1309,10 @@ loop do # OUTER LOOP - CATCHING REFRESHES VIA 'r'
1273
1309
  image_show("clear")
1274
1310
  close_screen
1275
1311
  # If launched via the script "r", return current dir and "r" will cd to that
1276
- File.write(ARGV[0], Dir.pwd) if ARGV[0] and ARGV[0].match(/\/tmp\/tmp/)
1312
+ begin
1313
+ File.write(ARGV[0], Dir.pwd) if ARGV[0] and ARGV[0].match(/\/tmp\/tmp/)
1314
+ rescue
1315
+ end
1277
1316
  end
1278
1317
  end
1279
1318
 
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.0
4
+ version: 1.3.4
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-10 00:00:00.000000000 Z
11
+ date: 2021-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: curses
@@ -33,7 +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.0: Added ''grep'' functionality via the ''g'' key'
36
+ other features. New in 1.3.4: Added key ''S'' to show comprehensive system info
37
+ (system, CPU, filesystem, latest dmesg messages)'
37
38
  email: g@isene.com
38
39
  executables:
39
40
  - rtfm