rtfm-filemanager 2.1 → 2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -3
  3. data/bin/rtfm +40 -24
  4. metadata +4 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1513671bf2225ce310f4da9d6456c24f9268b6adbbb295574f2251358bb1bc7d
4
- data.tar.gz: 8018bd4e856182ae60a7957e9381c4109c28423710ed224276633b9763b4d075
3
+ metadata.gz: c410aa1b0b696236f9954263caa3d7e670d7ca45da0d45d2e8cb94fc52d895d1
4
+ data.tar.gz: 6832505f97d8b81010c50905782af9eb2a36709386ee616d06c8f1024d798a54
5
5
  SHA512:
6
- metadata.gz: 84902969b49951e25999896cfb64e7712bb21032b6b5c1d43f239b3a926077faa7e5d7fb02c834587a004d5830b75517451c90ad84a82e230007802777703439
7
- data.tar.gz: 23f9324a0382237e030d9e172495ec22329c679d98c16c1f3e6c3943b68bd5b5930072939e8798f72e8862ceba4396447c31b632a22fc47e70fc455c8af9d7d2
6
+ metadata.gz: 7901006b50b618083589b017b66cb747d41c42d7bb170c95b00b19ddbdc0aa1d4921ddfe90ed2eebef10e040f0c15b7a1fa4b2557416d0d0d9b6201d34f8267f
7
+ data.tar.gz: d8666f8f471d72bc19fd27235e191604d09ef2dd7df58a51339fd9ec7c2cfa5ba7714d28a7aa5c8a2217dd5916cd31c3a473f2b31a397f336ba69ef15fce23a6
data/README.md CHANGED
@@ -147,7 +147,7 @@ M | Show marked items in right pane
147
147
  n | Jump to the next item matched by '/'
148
148
  N | Jump to the previous item matched by '/'
149
149
  ~ | Jump to Home directory
150
- f | Follow symlink to the directory where the target resides
150
+ \> | Follow symlink to the directory where the target resides
151
151
  L | Start 'locate' search for files, then use '#' to jump to desired line/directory
152
152
 
153
153
  ### Tagging
@@ -180,7 +180,6 @@ i | Invert/reverse the sorting
180
180
  O | Show the Ordering in the bottom window (the full ls command)
181
181
  G | Show git status for current directory
182
182
  H | Do a cryptographic hash of the current directory with subdirs. If a previous hash was made, compare and report if there has been any change
183
- S | Show comprehensive system info (system, CPU, filesystem, latest dmesg messages)
184
183
  I | Show OpenAI's description of the selected item and its content (if available). You must have installed the ruby-openai gem and added your openai secret key in the .rtfm.conf (add `@ai = "your-secret-openai-key") for this to work. If RTFM is installed as a gem, the ruby-openai gem is included in the installation
185
184
 
186
185
  ### Right pane
@@ -198,12 +197,14 @@ _ | Toggle preview of images in right pane
198
197
 
199
198
  Key | Description
200
199
  -------|------------------------------------------------------------------
201
- F | Show only files in the left pane matching extension(s) (e.g. "txt" or "pdf,png,jpg")
200
+ f | Show only files in the left pane matching extension(s) (e.g. "txt" or "pdf,png,jpg")
201
+ F | Show only files matching a pattern (Ruby Regex) (e.g. "abc" or "ab.+12(\w3)*")
202
202
  g | Run 'grep' to show files that contains the MATCH in current directory
203
203
  : | Enter "command mode" in bottom window (press ENTER to execute, press Ctrl-G to escape)
204
204
  ; | Show command history in right pane
205
205
  y | Copy path of selected item to primary selection (for pasting with middle mouse button)
206
206
  Y | Copy path of selected item to clipboard
207
+ S | Show comprehensive system info (system, CPU, filesystem, latest dmesg messages)
207
208
 
208
209
 
209
210
  ## A convenient shell function
data/bin/rtfm CHANGED
@@ -48,11 +48,11 @@ JUMPING AND MARKS
48
48
  ' = Jump to mark (next letter is the name of the mark [a-zA-Z'])
49
49
  The 5 latest directories visited are stored in marks 1-5 (1 being the very latest)
50
50
  / = Enter search string in bottom window to highlight matching items and jump to the first match
51
- \\ = Remove search pattern
51
+ \ = Remove search pattern
52
52
  n = Jump to the next item matched by '/'
53
53
  N = Jump to the previous item matched by '/'
54
54
  ~ = Jump to Home directory
55
- f = Follow symlink to the directory where the target resides
55
+ > = Follow symlink to the directory where the target resides
56
56
  L = Start 'locate' search for files, then use '#' to jump to desired line/directory
57
57
 
58
58
  TAGGING
@@ -77,7 +77,6 @@ DIRECTORY VIEWS
77
77
  G = Show git status for current directory
78
78
  H = Do a cryptographic hash of the current directory with subdirs
79
79
  If a previous hash was made, compare and report if there has been any change
80
- S = Show comprehensive system info (system, CPU, filesystem, latest dmesg messages)
81
80
  I = Show OpenAI's description of the selected item and its content (if available)
82
81
  You must have installed the ruby-openai gem and added your openai secret key
83
82
  in the .rtfm.conf (add `@ai = "your-secret-openai-key") for this to work.
@@ -87,16 +86,18 @@ RIGHT PANE
87
86
  TAB = Next page of the preview (if doc long and ∇ in the bottom right)
88
87
  S-TAB = Previous page (if you have moved down the document first - ∆ in the top right)
89
88
  w = Change the width of the left/right panes (left pane ⇒ ⅓ ⇒ ¼ ⇒ ⅕ ⇒ ⅙ ⇒ ½ ⇒ ⅓)
90
- - = Toggle preview in right pane (turn it off for faster traversing of directories)
91
- _ = Toggle preview of images in right pane
89
+ - = (Minus sign) Toggle preview in right pane (turn it off for faster traversing of directories)
90
+ _ = (Underscore) Toggle preview of images in right pane
92
91
 
93
92
  ADDITINAL COMMANDS
94
- F = Show only files in the left pane matching extension(s) (e.g. "txt" or "pdf,png,jpg")
93
+ f = Show only files in the left pane matching extension(s) (e.g. "txt" or "pdf,png,jpg")
94
+ F = Show only files matching a pattern (Ruby Regex) (e.g. "abc" or "ab.+12(\w3)*")
95
95
  g = Run 'grep' to show files that contains the MATCH in current directory
96
96
  : = Enter "command mode" in bottom window (press ENTER to execute, press Ctrl-G to escape)
97
97
  ; = Show command history in right pane
98
98
  y = Copy path of selected item to primary selection (for pasting with middle mouse button)
99
99
  Y = Copy path of selected item to clipboard
100
+ S = Show comprehensive System info (system, CPU, filesystem, latest dmesg messages)
100
101
 
101
102
  COPYRIGHT: Geir Isene, 2020-3. No rights reserved. See http://isene.com for more.
102
103
  HELPTEXT
@@ -179,7 +180,8 @@ begin # BASIC SETUP
179
180
  ## These should not be set by user in .rtfm.conf
180
181
  @directory = {} # Initialize the directory hash for remembering directories visited
181
182
  @searched = "" # Initialize the active searched for items
182
- @lsfiles = "" # File types to show (initially set to all file types"
183
+ @lsfiles = "" # File types to show (initially set to all file types) - not saved on exit
184
+ @lsmatch = "" # Files to match (initially set to matching all files) - not saved on exit
183
185
  @index = 0 # Set chosen item to first on startup
184
186
  @marks["'"] = Dir.pwd
185
187
  ## File type recognizers
@@ -430,7 +432,7 @@ def main_getkey # GET KEY FROM USER
430
432
  Dir.chdir
431
433
  @w_r.update = true
432
434
  @w_b.update = true
433
- when 'f' # Follow symlink
435
+ when '>' # Follow symlink
434
436
  @directory[Dir.pwd] = @selected # Store this directory before leaving
435
437
  mark_latest
436
438
  if File.symlink?(@selected)
@@ -682,11 +684,13 @@ def main_getkey # GET KEY FROM USER
682
684
  getch
683
685
  @break = true
684
686
  # ADDITIONAL COMMANDS
685
- when 'F' # Filter out filetypes not matching @lsfiles
687
+ when 'f' # Filter out filetypes not matching @lsfiles
686
688
  loop do
687
689
  @lsfiles = w_b_getstr("Filetype(s) to show: ", @lsfiles)
688
690
  break if @lsfiles.match(/^$|\w+(,\w+)*$/)
689
691
  end
692
+ when 'F' # Filter out files not matching @lsmatch
693
+ @lsmatch = w_b_getstr("Files will match RegEx: ", @lsmatch)
690
694
  when '/' # Get search string to mark items that match the input
691
695
  @w_b.nohistory = true
692
696
  @searched = w_b_getstr("/ ", "")
@@ -823,6 +827,31 @@ def mark_latest
823
827
  @marks["1"] = @marks["'"]
824
828
  @marks["'"] = Dir.pwd
825
829
  end
830
+ def get_files(win) # The core of the directory listings
831
+ ls_cmd = "ls #{@lsbase} #{@lsall} #{@lsorder} #{@lsinvert} #{@lsuser}" # Get files in current directory
832
+ ls_cmd += @selected_safe if win == "right"
833
+ @files = `#{ls_cmd} 2>/dev/null`.split("\n")
834
+ ls_cmd += " -H " if win == "right"
835
+ ls_cmd += %q[ -lhgG --time-style="long-iso" 2>/dev/null | awk '{printf "%s%12s%6s%6s%5s", $1,$4,$5,$3,$2 "\n"}']
836
+ @fspes = `#{ls_cmd} 2>/dev/null`.split("\n").drop(1)
837
+ if @lsfiles != "" or @lsmatch != ""
838
+ lsf = @lsfiles.split(",").map! {|e| e.strip}
839
+ dir_cmd = "ls -d "
840
+ dir_cmd += @selected_safe + "/" if win == "right"
841
+ dir_cmd += "*/"
842
+ dirs = `#{dir_cmd} 2>/dev/null`.split("/\n")
843
+ dirs.map!{|d| d.sub!(/.*\//, '')} if win == "right"
844
+ @files = @files - dirs
845
+ @fspes = @fspes - dirs
846
+ @files.select! {|f| lsf.any? {|l| File.extname(f) == ".#{l}"}} if @lsfiles != ""
847
+ @fspes.select! {|f| lsf.any? {|l| File.extname(f) == ".#{l}"}} if @lsfiles != ""
848
+ @files.select! {|f| f =~ /#{@lsmatch}/} if @lsmatch != ""
849
+ @fspes.select! {|f| f =~ /#{@lsmatch}/} if @lsmatch != ""
850
+ @files = dirs + @files
851
+ @fspes = dirs + @fspes
852
+ @w_r.update = true
853
+ end
854
+ end
826
855
  # TOP WINDOW FUNCTIONS
827
856
  def w_t_info # SHOW INFO IN @w_t
828
857
  text = " " + ENV['USER'].to_s + "@" + `hostname 2>/dev/null`.to_s.chop + ": " + Dir.pwd + "/"
@@ -1002,10 +1031,7 @@ def w_r_show # SHOW CONTENTS IN THE RIGHT WINDOW
1002
1031
  if @w_r.pager > 0
1003
1032
  pager_show
1004
1033
  elsif File.directory?(@selected)
1005
- ls_cmd = "ls #{@selected_safe} #{@lsbase} #{@lsall} #{@lsorder} #{@lsinvert} #{@lsuser}"
1006
- @files = `#{ls_cmd} 2>/dev/null`.split("\n")
1007
- ls_cmd += %q[ -lhgGH --time-style="long-iso" 2>/dev/null | awk '{printf "%s%12s%6s%6s%5s", $1,$4,$5,$3,$2 "\n"}']
1008
- @fspes = `#{ls_cmd} 2>/dev/null`.split("\n").drop(1)
1034
+ get_files("right")
1009
1035
  list_dir(false)
1010
1036
  # TEXT
1011
1037
  elsif File.read(@selected).force_encoding("UTF-8").valid_encoding? and @w_r.pager == 0
@@ -1437,17 +1463,7 @@ loop do # OUTER LOOP - CATCHING REFRESHES VIA 'r'
1437
1463
  rescue
1438
1464
  Dir.chdir
1439
1465
  end
1440
- lsf = @lsfiles.split(",").map! {|e| "*." + e.strip }
1441
- lsf = lsf.join(" ")
1442
- ls_cmd = "ls #{@lsbase} #{@lsall} #{@lsorder} #{@lsinvert} #{@lsuser} #{lsf}" # Get files in current directory
1443
- @files = `#{ls_cmd} 2>/dev/null`.split("\n")
1444
- ls_cmd += %q[ -lhgG --time-style="long-iso" 2>/dev/null | awk '{printf "%s%12s%6s%6s%5s", $1,$4,$5,$3,$2 "\n"}']
1445
- @fspes = `#{ls_cmd} 2>/dev/null`.split("\n").drop(1)
1446
- if @lsfiles != ""
1447
- dirs = `ls -d */`.split("/\n")
1448
- @files = dirs + @files
1449
- @fspes = dirs + @fspes
1450
- end
1466
+ get_files("left")
1451
1467
  if Dir.pwd != dir_old
1452
1468
  if @directory.key?(Dir.pwd)
1453
1469
  @selected = @directory[Dir.pwd]
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: '2.1'
4
+ version: '2.2'
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-03-21 00:00:00.000000000 Z
11
+ date: 2023-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: curses
@@ -47,7 +47,8 @@ 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 2.1: Added filter-by-extension via the key ''F'''
50
+ other features. New in 2.1: Added keys ''f'' (show only file types) and ''F'' (show
51
+ only files matching a RegEx) and moved follow-symlink from ''f'' to ''>''.'
51
52
  email: g@isene.com
52
53
  executables:
53
54
  - rtfm