rtfm-filemanager 1.3.1 → 1.3.5
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 +69 -18
- 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: 2fdfba59295e424a39605d0501e0df29a7a37d9ad36429adb412d8d13c54c752
         | 
| 4 | 
            +
              data.tar.gz: 2a5523150436439dbbcabf66a7e9c8505c7ad30c82fd827e2b198ab5f73361e9
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 5e1cf39a6d5e205a7ea226bc8c70d885037077d1ed918450634a8fc9feb179dee05a03f58bcc174609c7419231b2d4df3b1f1b3bd7cb4cc89bd4a01d658124c6
         | 
| 7 | 
            +
              data.tar.gz: 5a152abd6d7c54de6c116f6ecac690e939cd2d07b28a1e7b9d4261337f72e6b23a833162567ccd6fb6674d5e92882551d9f27e3d7167ac4d61c00d6eb894b492
         | 
    
        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  | 
| 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 |  | 
| @@ -273,6 +276,7 @@ def main_getkey # GET KEY FROM USER | |
| 273 276 | 
             
              case chr
         | 
| 274 277 | 
             
              # BASIC KEYS
         | 
| 275 278 | 
             
              when '?' # Show helptext in right window 
         | 
| 279 | 
            +
                @w_r.fg = 249
         | 
| 276 280 | 
             
                w_r_info(@help)
         | 
| 277 281 | 
             
                @w_b.update = true
         | 
| 278 282 | 
             
              when 'r' # Refresh all windows 
         | 
| @@ -364,6 +368,7 @@ def main_getkey # GET KEY FROM USER | |
| 364 368 | 
             
                @w_b.update = true
         | 
| 365 369 | 
             
              when 'M' # Show marks 
         | 
| 366 370 | 
             
                @marks = @marks.sort.to_h
         | 
| 371 | 
            +
                @w_r.fg = 147
         | 
| 367 372 | 
             
                marks_info
         | 
| 368 373 | 
             
                @w_r.update = false
         | 
| 369 374 | 
             
                @w_b.update = true
         | 
| @@ -437,6 +442,7 @@ def main_getkey # GET KEY FROM USER | |
| 437 442 | 
             
                @w_r.update = true
         | 
| 438 443 | 
             
                @w_b.update = true
         | 
| 439 444 | 
             
              when 'T' # Show tagged list 
         | 
| 445 | 
            +
                @w_r.fg = 196
         | 
| 440 446 | 
             
                tagged_info
         | 
| 441 447 | 
             
                @w_r.update = false
         | 
| 442 448 | 
             
                @w_b.update = true
         | 
| @@ -521,6 +527,7 @@ def main_getkey # GET KEY FROM USER | |
| 521 527 | 
             
              when 'O' # Show the Ordering in the bottom window (the full ls command)
         | 
| 522 528 | 
             
                w_b_info(" Full 'ls' command: ls <@s> #{@lsbase} #{@lsall} #{@lsorder} #{@lsinvert} #{@lsuser}")
         | 
| 523 529 | 
             
              when 'G' # Git status for selected item or current dir
         | 
| 530 | 
            +
                @w_r.fg = 214
         | 
| 524 531 | 
             
                if File.exist?(".git")
         | 
| 525 532 | 
             
                  w_r_info(`git status 2>/dev/null`)
         | 
| 526 533 | 
             
                else
         | 
| @@ -529,6 +536,7 @@ def main_getkey # GET KEY FROM USER | |
| 529 536 | 
             
                @w_r.update = false
         | 
| 530 537 | 
             
                @w_b.update = true
         | 
| 531 538 | 
             
              when 'H' # Compare with previous hash status or write hash status if no existing hash
         | 
| 539 | 
            +
                @w_r.fg = 213
         | 
| 532 540 | 
             
                hashcmd = "\(find #{Dir.pwd} -type f -print0  | sort -z | xargs -0 sha1sum; find #{Dir.pwd}"\
         | 
| 533 541 | 
             
                          " \\( -type f -o -type d \\) -print0 | sort -z | xargs -0 stat -c '%n %a'\) | sha1sum | cut -c -40"
         | 
| 534 542 | 
             
                begin
         | 
| @@ -551,6 +559,25 @@ def main_getkey # GET KEY FROM USER | |
| 551 559 | 
             
                end
         | 
| 552 560 | 
             
                @w_r.update = true
         | 
| 553 561 | 
             
                @w_b.update = false
         | 
| 562 | 
            +
              when 'S' # Show comprehensive system info
         | 
| 563 | 
            +
                @w_r.pager_cmd = ""
         | 
| 564 | 
            +
                systext  = `uname -o`.chop + "  "
         | 
| 565 | 
            +
                systext += `uname -r`.chop + "  "
         | 
| 566 | 
            +
                systext += `uname -v`.chop + "  "
         | 
| 567 | 
            +
                systext += `uname -p` + "\n"
         | 
| 568 | 
            +
                systext += `free -h`  + "\n"
         | 
| 569 | 
            +
                systext += "CPUs = " + `nproc`.chop + "  "
         | 
| 570 | 
            +
                cpuinfo    = `lscpu`
         | 
| 571 | 
            +
                systext += cpuinfo[/^.*Model name:\s*(.*)/, 1] + "  "
         | 
| 572 | 
            +
                systext += "Max: " + cpuinfo[/^.*CPU max MHz:\s*(.*)/, 1][/(.*),.*/, 1] + "MHz  "
         | 
| 573 | 
            +
                systext += "Min: " + cpuinfo[/^.*CPU min MHz:\s*(.*)/, 1][/(.*),.*/, 1] + "MHz  "
         | 
| 574 | 
            +
                systext += "\n\n"
         | 
| 575 | 
            +
                systext += `df -H`
         | 
| 576 | 
            +
                systext += "\nDMESG:\n"
         | 
| 577 | 
            +
                systext += `dmesg | tail -10`
         | 
| 578 | 
            +
                @w_r.fg    = 155
         | 
| 579 | 
            +
                w_r_info(systext)
         | 
| 580 | 
            +
                @w_r.update = false
         | 
| 554 581 | 
             
              # RIGHT PANE
         | 
| 555 582 | 
             
              when 'ENTER' # Refresh right pane
         | 
| 556 583 | 
             
                @w_r.clr # First clear the window, then clear any previously showing image
         | 
| @@ -625,7 +652,10 @@ def main_getkey # GET KEY FROM USER | |
| 625 652 | 
             
                @w_r.pager      = 0
         | 
| 626 653 | 
             
                @w_r.pager_more = false
         | 
| 627 654 | 
             
              end
         | 
| 628 | 
            -
               | 
| 655 | 
            +
              begin
         | 
| 656 | 
            +
                @w_r.update = true if dir != Dir.pwd
         | 
| 657 | 
            +
              rescue
         | 
| 658 | 
            +
              end
         | 
| 629 659 | 
             
            end
         | 
| 630 660 | 
             
            def conf_write
         | 
| 631 661 | 
             
              if File.exist?(Dir.home+'/.rtfm.conf')
         | 
| @@ -646,6 +676,8 @@ def conf_write | |
| 646 676 | 
             
                conf += "@lsall = \"#{@lsall}\"\n"
         | 
| 647 677 | 
             
                conf.sub!(/^@lsorder.*\n/, "") 
         | 
| 648 678 | 
             
                conf += "@lsorder = \"#{@lsorder}\"\n"
         | 
| 679 | 
            +
                conf.sub!(/^@lsinvert.*\n/, "") 
         | 
| 680 | 
            +
                conf += "@lsinvert = \"#{@lsinvert}\"\n"
         | 
| 649 681 | 
             
                conf.sub!(/^@width.*\n/, "") 
         | 
| 650 682 | 
             
                conf += "@width = #{@width}\n"
         | 
| 651 683 | 
             
                conf.sub!(/^@border.*\n/, "") 
         | 
| @@ -924,7 +956,7 @@ def w_r_info(info) # SHOW INFO IN THE RIGHT WINDOW | |
| 924 956 | 
             
              image_show("clear") if @image; @image = false
         | 
| 925 957 | 
             
            end
         | 
| 926 958 | 
             
            def marks_info # SHOW MARKS IN RIGHT WINDOW
         | 
| 927 | 
            -
              info = " | 
| 959 | 
            +
              info = "MARKS:\n"
         | 
| 928 960 | 
             
              unless @marks.empty?
         | 
| 929 961 | 
             
                @marks.each do |mark, dir|
         | 
| 930 962 | 
             
                  info += "#{mark} = #{dir}\n"
         | 
| @@ -935,7 +967,7 @@ def marks_info # SHOW MARKS IN RIGHT WINDOW | |
| 935 967 | 
             
              w_r_info(info)
         | 
| 936 968 | 
             
            end
         | 
| 937 969 | 
             
            def tagged_info # SHOW THE LIST OF TAGGED ITEMS IN @w_r
         | 
| 938 | 
            -
              info = " | 
| 970 | 
            +
              info = "TAGGED:\n"
         | 
| 939 971 | 
             
              @tagged.empty? ? info += "(None)" : info += @tagged.join("\n")
         | 
| 940 972 | 
             
              w_r_info(info)
         | 
| 941 973 | 
             
            end
         | 
| @@ -1004,7 +1036,13 @@ def pager_show # SHOW THE CURRENT PAGE CONTENT | |
| 1004 1036 | 
             
              if @w_r.pager_cmd.match(/batcat/)
         | 
| 1005 1037 | 
             
                syntax_highlight(input)
         | 
| 1006 1038 | 
             
              else
         | 
| 1007 | 
            -
                @w_r  | 
| 1039 | 
            +
                if @w_r.fg == nil
         | 
| 1040 | 
            +
                  init_pair(255, 255, 0)
         | 
| 1041 | 
            +
                  @w_r.fg = 255
         | 
| 1042 | 
            +
                else 
         | 
| 1043 | 
            +
                  init_pair(@w_r.fg, @w_r.fg, 0)
         | 
| 1044 | 
            +
                end
         | 
| 1045 | 
            +
                @w_r.attron(color_pair(@w_r.fg)) { @w_r << input }
         | 
| 1008 1046 | 
             
              end
         | 
| 1009 1047 | 
             
              (@w_r.maxy - @w_r.cury).times {@w_r.deleteln()} # Clear to bottom of window
         | 
| 1010 1048 | 
             
              pager_add_markers
         | 
| @@ -1171,17 +1209,19 @@ def w_b_exec(cmd) # EXECUTE COMMAND FROM @W_B | |
| 1171 1209 | 
             
                return
         | 
| 1172 1210 | 
             
              end
         | 
| 1173 1211 | 
             
              begin
         | 
| 1174 | 
            -
                 | 
| 1175 | 
            -
                   | 
| 1176 | 
            -
             | 
| 1177 | 
            -
             | 
| 1178 | 
            -
                   | 
| 1179 | 
            -
             | 
| 1180 | 
            -
             | 
| 1181 | 
            -
                   | 
| 1182 | 
            -
             | 
| 1183 | 
            -
             | 
| 1184 | 
            -
             | 
| 1212 | 
            +
                status = Timeout::timeout(5) {
         | 
| 1213 | 
            +
                  begin
         | 
| 1214 | 
            +
                    @w_r.pager_cmd = "#{cmd} | batcat -n --color=always 2>/dev/null"
         | 
| 1215 | 
            +
                    @w_r.text = `#{@w_r.pager_cmd} 2>/dev/null`
         | 
| 1216 | 
            +
                  rescue
         | 
| 1217 | 
            +
                    @w_r.text = `#{cmd} 2>/dev/null`
         | 
| 1218 | 
            +
                  end
         | 
| 1219 | 
            +
                  unless @w_r.text == "" or @w_r.text == nil
         | 
| 1220 | 
            +
                    pager_start
         | 
| 1221 | 
            +
                    pager_show
         | 
| 1222 | 
            +
                    @w_r.update = false
         | 
| 1223 | 
            +
                  end
         | 
| 1224 | 
            +
                }
         | 
| 1185 1225 | 
             
              rescue
         | 
| 1186 1226 | 
             
                w_b_info(" Failed to execute command (#{cmd})")
         | 
| 1187 1227 | 
             
              end
         | 
| @@ -1224,6 +1264,11 @@ loop do # OUTER LOOP - CATCHING REFRESHES VIA 'r' | |
| 1224 1264 | 
             
                  @w_r.update = false
         | 
| 1225 1265 | 
             
                end
         | 
| 1226 1266 | 
             
                loop do # INNER, CORE LOOP 
         | 
| 1267 | 
            +
                  begin # Jump to home dir if current dir is externally removed
         | 
| 1268 | 
            +
                    Dir.pwd
         | 
| 1269 | 
            +
                  rescue
         | 
| 1270 | 
            +
                    Dir.chdir
         | 
| 1271 | 
            +
                  end
         | 
| 1227 1272 | 
             
                  system("printf \"\033]0;RTFM: #{Dir.pwd}\007\"")   # Set Window title to path 
         | 
| 1228 1273 | 
             
                  ls_cmd  = "ls #{@lsbase} #{@lsall} #{@lsorder} #{@lsinvert} #{@lsuser}" # Get files in current directory 
         | 
| 1229 1274 | 
             
                  @files  = `#{ls_cmd} 2>/dev/null`.split("\n")
         | 
| @@ -1260,7 +1305,10 @@ loop do # OUTER LOOP - CATCHING REFRESHES VIA 'r' | |
| 1260 1305 | 
             
                  @w_l.setpos(0,0)
         | 
| 1261 1306 | 
             
                  list_dir(true)
         | 
| 1262 1307 | 
             
                  @w_l.refresh
         | 
| 1263 | 
            -
                   | 
| 1308 | 
            +
                  if @w_r.update and @preview
         | 
| 1309 | 
            +
                    w_r_show
         | 
| 1310 | 
            +
                    @w_r.fg = 255
         | 
| 1311 | 
            +
                  end
         | 
| 1264 1312 | 
             
                  Curses.curs_set(1) # Clear residual cursor
         | 
| 1265 1313 | 
             
                  Curses.curs_set(0) # ...from editing files 
         | 
| 1266 1314 | 
             
                  @tag = false       # Clear tag pattern
         | 
| @@ -1275,7 +1323,10 @@ loop do # OUTER LOOP - CATCHING REFRESHES VIA 'r' | |
| 1275 1323 | 
             
                image_show("clear")
         | 
| 1276 1324 | 
             
                close_screen
         | 
| 1277 1325 | 
             
                # If launched via the script "r", return current dir and "r" will cd to that
         | 
| 1278 | 
            -
                 | 
| 1326 | 
            +
                begin
         | 
| 1327 | 
            +
                  File.write(ARGV[0], Dir.pwd) if ARGV[0] and ARGV[0].match(/\/tmp\/tmp/)
         | 
| 1328 | 
            +
                rescue
         | 
| 1329 | 
            +
                end
         | 
| 1279 1330 | 
             
              end
         | 
| 1280 1331 | 
             
            end
         | 
| 1281 1332 |  | 
    
        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.5
         | 
| 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-25 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.5: Sexify by color some of the info shown in right pane
         | 
| 37 | 
            +
              (like Help, Tagged, Marks and System Info)'
         | 
| 38 38 | 
             
            email: g@isene.com
         | 
| 39 39 | 
             
            executables:
         | 
| 40 40 | 
             
            - rtfm
         |