rtfm-filemanager 3.0.3 → 3.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +41 -30
- data/bin/rtfm +72 -59
- metadata +5 -4
- data/.rtfm.launch +0 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3699cc2dad80b5897439a8dae2a37a6865f2ce4eaab7f9f4f145aa81680796a8
|
4
|
+
data.tar.gz: d8d969d05f715d99a6bf610771559810202da03b4de75d272c8ffb30f58b5e02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3498bc171b280b56c4a4661a8f4c41a9b4878392cefd8f9a33907d0d8dab771d4627e662b48fb3e23569c2433d6f9070c5d16068d6d350bd054e61f74e392517
|
7
|
+
data.tar.gz: f17194010e4c9e218df33cfec4edaf0560c89c5e964709518d1374bc226ee094bd211695917dd96c249e35ace943d15e40798f47b6355bc9a82e9530d7100369
|
data/README.md
CHANGED
@@ -18,7 +18,7 @@ Note: RTFM works best with the (u)rxvt, xterm and Eterm terminal emulators.
|
|
18
18
|
## Features
|
19
19
|
|
20
20
|
RTFM is one of the more feature rich terminal file managers. Some of the
|
21
|
-
features:
|
21
|
+
features are:
|
22
22
|
|
23
23
|
* RTFM shows images inline in the terminal (can be turned off)
|
24
24
|
* File contents is shown with proper syntax highlighting
|
@@ -64,17 +64,21 @@ of the selected item (directory or file) is shown in the right pane. The right
|
|
64
64
|
pane is also used to show information such as the currently tagged items, your
|
65
65
|
(book)marks, output from commands, etc.
|
66
66
|
|
67
|
-
|
67
|
+
When you start RTFM, you can supply a directory path as an argument to let
|
68
|
+
RTFM start up in that directory.
|
69
|
+
|
70
|
+
You can run any command in the bottom "command bar" and have the output
|
68
71
|
presented in the right pane. Use LEFT and RIGHT keys to go back and forth on
|
69
72
|
the command line, HOME to beginning of line, END to end of line, Backspace or
|
70
73
|
Ctrl-h to delete previous character, Ctrl-w to delete previous word, TAB to
|
71
74
|
complete directories and file names and ENTER to issue the command, while
|
72
|
-
Ctrl-u deletes the line. Issuing ENTER on a blank line has no effect.
|
75
|
+
Ctrl-u deletes the line. Issuing ENTER on a blank line has no effect. Use
|
76
|
+
Ctrl-g to leave the command bar without executing anything.
|
73
77
|
|
74
78
|
## Installation
|
75
79
|
|
76
|
-
You can install RTFM by
|
77
|
-
|
80
|
+
You can install RTFM by coloning this repo and put the file `rtfm` in your
|
81
|
+
"bin" directory. Or you can simply run `gem install rtfm-filemanager`.
|
78
82
|
|
79
83
|
There are two basic prerequisites needed: `x11-utils` and `xdotool`. On
|
80
84
|
Ubuntu these would be installed via `apt install x11-utils xdotool`.
|
@@ -82,12 +86,12 @@ Ubuntu these would be installed via `apt install x11-utils xdotool`.
|
|
82
86
|
In order to run RTFM (without generating [a bunch of
|
83
87
|
warnings](https://github.com/isene/RTFM/issues/1)), you need to do a `gem
|
84
88
|
install curses` (gets version 1.3.2) instead of installing via `apt install
|
85
|
-
ruby-curses` (gets version 1.2.4-1build1 on Ubuntu 20.04).
|
89
|
+
ruby-curses` (gets version 1.2.4-1build1 on Ubuntu 20.04). If you install RTFM
|
90
|
+
via `gem install rtfm-filemanager`, this dependency is already taken care of.
|
86
91
|
|
87
92
|
Content of text files are handled by `cat` - or by `bat` if you want beautiful
|
88
|
-
highlighting. Other files are shown via external programs
|
89
|
-
|
90
|
-
last column):
|
93
|
+
highlighting. Other files are shown via external programs (Debian/Ubuntu
|
94
|
+
family of Linux distros command in last column):
|
91
95
|
|
92
96
|
File type | Requirements | Installation
|
93
97
|
----------------------------|----------------------------------|-------------------------------
|
@@ -109,13 +113,17 @@ sudo gem install curses
|
|
109
113
|
git clone https://github.com/isene/RTFM
|
110
114
|
cd RTFM
|
111
115
|
sudo cp rtfm /usr/bin/
|
112
|
-
|
113
|
-
|
116
|
+
```
|
117
|
+
Or with a simpler gem install:
|
118
|
+
```
|
119
|
+
sudo apt update
|
120
|
+
sudo apt install ruby-full git libncurses-dev x11-utils xdotool bat poppler-utils odt2txt docx2txt catdoc w3m imagemagick ffmpegthumbnailer
|
121
|
+
gem install rtfm-filemanager
|
114
122
|
```
|
115
123
|
|
116
124
|
## Screenshot
|
117
125
|
|
118
|
-
![](img/screenshot.png)
|
126
|
+
![RTFM screenshot](img/screenshot.png)
|
119
127
|
|
120
128
|
## Image preview in the terminal
|
121
129
|
|
@@ -153,11 +161,12 @@ These are the set of keys to move around and do actions within RTFM:
|
|
153
161
|
Key | Description
|
154
162
|
-------|------------------------------------------------------------------
|
155
163
|
? | Show this help text
|
156
|
-
r | Refresh RTFM (recreates
|
164
|
+
r | Refresh RTFM (recreates the panes. Use on terminal resize or when there is garbage somewhere)
|
157
165
|
R | Reload configuration (~/.rtfm.conf)
|
158
166
|
W | Write parameters to ~/.rtfm.conf (@lsall, @lslong, @lsorder, @lsinvert, @border, @width, @preview, @tagged, @marks)
|
159
167
|
q | Quit
|
160
168
|
Q | QUIT (without writing changes to the config file)
|
169
|
+
v | Display RTFM version in bottom command bar
|
161
170
|
|
162
171
|
### Motion
|
163
172
|
|
@@ -186,7 +195,7 @@ M | Show marked items in right pane
|
|
186
195
|
|
187
196
|
Key | Description
|
188
197
|
-------|------------------------------------------------------------------
|
189
|
-
/ | Enter search string in bottom
|
198
|
+
/ | Enter search string in bottom command bar to highlight matching items and jump to the first match
|
190
199
|
\\ | Remove search pattern
|
191
200
|
n | Jump to the next item matched by '/'
|
192
201
|
N | Jump to the previous item matched by '/'
|
@@ -211,7 +220,7 @@ p | Put (copy) tagged items here
|
|
211
220
|
P | PUT (move) tagged items here
|
212
221
|
s | Create symlink to tagged items here
|
213
222
|
d | Delete selected item and tagged items. Press 'y' to confirm
|
214
|
-
c | Change/rename selected (adds command to
|
223
|
+
c | Change/rename selected (adds the proper command to change in the command bar)
|
215
224
|
Ctrl-o | Change ownership to user:group of selected and tagged items
|
216
225
|
Ctrl-p | Change permissions of selected and tagged items. Format = rwxr-xr-x or 755 or rwx (applies the trio to user, group and others)
|
217
226
|
z | Extract tagged zipped archive to current directory
|
@@ -225,7 +234,7 @@ a | Show all (also hidden) items
|
|
225
234
|
A | Show All info per item (show item attributes)
|
226
235
|
o | Change the order/sorting of directories (circular toggle)
|
227
236
|
i | Invert/reverse the sorting
|
228
|
-
O | Show the Ordering in the bottom
|
237
|
+
O | Show the Ordering in the bottom command bar (the full ls command)
|
229
238
|
G | Show git status for current directory
|
230
239
|
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
|
231
240
|
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
|
@@ -237,7 +246,7 @@ Key | Description
|
|
237
246
|
ENTER | Refresh the right pane
|
238
247
|
TAB | Next page of the preview (if doc long and ∇ in the bottom right)
|
239
248
|
S-TAB | Previous page (if you have moved down the document first - ∆ in the top right)
|
240
|
-
w | Change the width of the left/right panes (left pane ⇒
|
249
|
+
w | Change the width of the left/right panes (left pane ⇒ 20%, 30%, 40%, 50%, 60%)
|
241
250
|
\- | Toggle preview in right pane (turn it off for faster traversing of directories)
|
242
251
|
_ | Toggle preview of images in right pane
|
243
252
|
b | Toggle syntax highlighting (and line numbering)
|
@@ -247,24 +256,25 @@ b | Toggle syntax highlighting (and line numbering)
|
|
247
256
|
Key | Description
|
248
257
|
-------|------------------------------------------------------------------
|
249
258
|
f | Show only files in the left pane matching extension(s) (e.g. "txt" or "pdf,png,jpg")
|
250
|
-
F | Show only files matching a pattern (Ruby Regex) (e.g. "abc" or "ab.+12(\w3)
|
259
|
+
F | Show only files matching a pattern (Ruby Regex) (e.g. "abc" or "ab.+12(\w3)+")
|
251
260
|
B | Toggle border
|
252
|
-
: | Enter "command mode" in bottom
|
261
|
+
: | Enter "command mode" in bottom command bar (press ENTER to execute, press Ctrl-G to escape)
|
253
262
|
; | Show command history in right pane
|
254
263
|
y | Copy path of selected item to primary selection (for pasting with middle mouse button)
|
255
264
|
Y | Copy path of selected item to clipboard
|
256
|
-
|
265
|
+
Ctrl-y | Copy content of right pane to clipboard
|
257
266
|
S | Show comprehensive system info (system, CPU, filesystem, latest dmesg messages)
|
258
|
-
Ctrl-n | Invoke navi (see https://github.com/denisidoro/navi) with any output in right
|
259
|
-
|
260
|
-
|
261
|
-
## A convenient shell function
|
262
|
-
Add this line to your `.bashrc` or `.zshrc` to make RTFM exit to the current
|
263
|
-
directory by launching the file manager via `r` in the terminal:
|
267
|
+
Ctrl-n | Invoke navi (see https://github.com/denisidoro/navi) with any output in right pane
|
264
268
|
|
265
|
-
|
269
|
+
## Keyboard cheat sheet
|
270
|
+
![RTFM keyboard cheat sheet](img/rtfm-kb.png)
|
266
271
|
|
267
|
-
|
272
|
+
## First run
|
273
|
+
The first time you run RTFM, you are greeted with a welcome message. RTFM will
|
274
|
+
then create a file (`.rtfm.launch`) in your home directory that will let you
|
275
|
+
launch RTFM via the one key command `r`. It also lets RTFM exit in the
|
276
|
+
directory you are currently in (inside of RTFM) rather than where you launched
|
277
|
+
RTFM.
|
268
278
|
|
269
279
|
With this, you can jump around in your directory structure via RTFM, exit to
|
270
280
|
the desired directory, do work in the terminal and go back into RTFM via `r`.
|
@@ -291,7 +301,8 @@ any files containg the word "test", you could do this:
|
|
291
301
|
```
|
292
302
|
|
293
303
|
To change the default width of the left pane to something other than ⅓rd of
|
294
|
-
the terminal width: `@width = 5` (would set the left pane width to
|
304
|
+
the terminal width: `@width = 5` (would set the left pane width to 50% of the
|
305
|
+
window size).
|
295
306
|
|
296
307
|
To add borders in RTFM: `@border = true`
|
297
308
|
|
@@ -345,6 +356,6 @@ others I have found. If you come up with a feature request I feel is cool, I
|
|
345
356
|
may include it. Bug reports are always welcome.
|
346
357
|
|
347
358
|
A note to developers: You can hit the "@" key to enter the Ruby debug mode
|
348
|
-
where anything you enter in the bottom command
|
359
|
+
where anything you enter in the bottom command bar will be sent to the Ruby
|
349
360
|
eval() function and output to the right pane. You can for instance issue
|
350
361
|
`puts @searched` to see the currently active search pattern.
|
data/bin/rtfm
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
# for any damages resulting from its use. Further, I am under no
|
15
15
|
# obligation to maintain or extend this software. It is provided
|
16
16
|
# on an 'as is' basis without any expressed or implied warranty.
|
17
|
-
@version = "3.
|
17
|
+
@version = "3.8"
|
18
18
|
|
19
19
|
# PRELIMINARIES
|
20
20
|
@help = <<HELPTEXT
|
@@ -104,7 +104,7 @@ RIGHT PANE
|
|
104
104
|
|
105
105
|
ADDITIONAL COMMANDS
|
106
106
|
f = Show only files in the left pane matching extension(s) (e.g. "txt" or "pdf,png,jpg")
|
107
|
-
F = Show only files matching a pattern (Ruby Regex) (e.g. "abc" or "ab.+12(\w3)
|
107
|
+
F = Show only files matching a pattern (Ruby Regex) (e.g. "abc" or "ab.+12(\w3)+")
|
108
108
|
B = Toggle border
|
109
109
|
: = Enter "command mode" in bottom window (press ENTER to execute, press Ctrl-G to escape)
|
110
110
|
; = Show command history in right pane
|
@@ -116,30 +116,62 @@ ADDITIONAL COMMANDS
|
|
116
116
|
|
117
117
|
COPYRIGHT: Geir Isene, 2020-3. No rights reserved. See http://isene.com for more.
|
118
118
|
HELPTEXT
|
119
|
-
|
119
|
+
def firstrun
|
120
|
+
@firstrun = <<~FIRSTRUN
|
120
121
|
|
121
|
-
Welcome to RTFM - the Ruby Terminal File Manager. This help text is shown on the first run.
|
122
|
-
|
123
|
-
|
122
|
+
Welcome to RTFM - the Ruby Terminal File Manager. This help text is shown on the first run.
|
123
|
+
Next time you run RTFM, you can launch it from your terminal with a one letter command: "r"
|
124
|
+
When launched this way, RTFM will also exit in the directory you are currently in.
|
124
125
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
Viewing
|
131
|
-
Viewing
|
132
|
-
Viewing MS
|
133
|
-
Viewing
|
134
|
-
Viewing
|
126
|
+
To benefit fully from all the features, you need to install some auxilliary software.
|
127
|
+
On Ubuntu Linux you would use "apt install":
|
128
|
+
|
129
|
+
Basic requirments is "x11-utils" and "xdotool": apt install x11-utils xdotool
|
130
|
+
Syntax highlighting of text uses "bat": apt install bat
|
131
|
+
Viewing PDFs uses "pdftotext": apt install poppler-utils
|
132
|
+
Viewing LibreOffice docs uses "odt2txt": apt install odt2txt
|
133
|
+
Viewing MS docx uses "docx2txt": apt install docx2txt
|
134
|
+
Viewing MS pptx uses "unzip": apt install unzip
|
135
|
+
Viewing MS xlsx uses "ssconvert": apt install gnumeric
|
136
|
+
Viewing MS doc/xls/ppt uses "catdoc, xls2csv and catppt": apt install catdoc
|
137
|
+
Viewing Images uses "w3m and ImageMagick": apt install w3m imagemagick
|
138
|
+
Viewing Video thumbnails uses "ffmpegthumbnailer" apt install ffmpegthumbnailer
|
139
|
+
|
140
|
+
All of the above:
|
141
|
+
apt install x11-utils xdotool bat poppler-utils odt2txt docx2txt unzip gnumeric catdoc w3m imagemagick ffmpegthumbnailer
|
135
142
|
|
136
143
|
FIRSTRUN
|
137
|
-
|
144
|
+
|
145
|
+
if not File.exist?(Dir.home+'/.rtfm.launch')
|
146
|
+
@rtfmlaunch = <<RTFMLAUNCH
|
147
|
+
# This is the RTFM launcher (https://github.com/isene/RTFM)
|
148
|
+
function r {
|
149
|
+
f=$(mktemp)
|
150
|
+
(
|
151
|
+
set +e
|
152
|
+
rtfm "$f"
|
153
|
+
code=$?
|
154
|
+
if [ "$code" != 0 ]; then
|
155
|
+
rm -f "$f"
|
156
|
+
exit "$code"
|
157
|
+
fi
|
158
|
+
)
|
159
|
+
code=$?
|
160
|
+
if [ "$code" != 0 ]; then
|
161
|
+
return "$code"
|
162
|
+
fi
|
163
|
+
d=$(<"$f")
|
164
|
+
rm -f "$f"
|
165
|
+
cd "$d"
|
166
|
+
}
|
167
|
+
RTFMLAUNCH
|
168
|
+
File.write(Dir.home+'/.rtfm.launch', @rtfmlaunch)
|
169
|
+
@shell = File.basename(`echo "$SHELL"`.chomp)
|
170
|
+
`echo "source ~/.rtfm.launch" >> .#{@shell}rc`
|
171
|
+
end
|
172
|
+
|
138
173
|
puts @firstrun
|
139
|
-
puts "... hit ENTER to show the
|
140
|
-
STDIN.gets
|
141
|
-
puts @help
|
142
|
-
puts "\n... hit ENTER to start RTFM. Enjoy :-)"
|
174
|
+
puts "\n... hit ENTER to start RTFM. Hit ? inside RTFM to show the help text. Enjoy :-)"
|
143
175
|
STDIN.gets
|
144
176
|
end
|
145
177
|
begin # BASIC SETUP
|
@@ -150,6 +182,8 @@ begin # BASIC SETUP
|
|
150
182
|
require 'curses'
|
151
183
|
include Curses
|
152
184
|
|
185
|
+
firstrun unless File.exist?(Dir.home+'/.rtfm.conf')
|
186
|
+
|
153
187
|
def cmd?(command)
|
154
188
|
system("which #{command} > /dev/null 2>&1")
|
155
189
|
end
|
@@ -165,7 +199,6 @@ begin # BASIC SETUP
|
|
165
199
|
cmd?('bat') ? @bat = "bat" : @bat = "batcat"
|
166
200
|
|
167
201
|
STDIN.set_encoding(Encoding::UTF_8) # Set encoding for STDIN
|
168
|
-
LScolors = `echo $LS_COLORS` # Import LS_COLORS
|
169
202
|
|
170
203
|
## Curses setup
|
171
204
|
Curses.init_screen
|
@@ -217,8 +250,10 @@ begin # BASIC SETUP
|
|
217
250
|
if File.exist?(Dir.home+'/.rtfm.conf')
|
218
251
|
load(Dir.home+'/.rtfm.conf')
|
219
252
|
end
|
253
|
+
Dir.chdir(ARGV[0]) if Dir.exist?(ARGV[0]) and ARGV[0] !~ /\/tmp/
|
220
254
|
end
|
221
|
-
|
255
|
+
# CLASS EXTENSIONS
|
256
|
+
class Curses::Window
|
222
257
|
attr_accessor :fg, :bg, :attr, :text, :update, :pager, :pager_more, :pager_cmd, :locate, :nohistory
|
223
258
|
# General extensions (see https://github.com/isene/Ruby-Curses-Class-Extension)
|
224
259
|
def clr
|
@@ -248,16 +283,6 @@ class Curses::Window # CLASS EXTENSION
|
|
248
283
|
# RTFM specific extensions
|
249
284
|
end
|
250
285
|
# GENERIC FUNCTIONS
|
251
|
-
def get_ls_color(type) # GET THE COLOR FOR THE FILETYPE FROM IMPORTED LS_COLORS
|
252
|
-
bold = 0
|
253
|
-
begin
|
254
|
-
color = LScolors.match(/#{type}=\d*;\d*;(\d*)/)[1]
|
255
|
-
bold = 1 if LScolors.match(/#{type}=\d*;\d*;\d*;1/)
|
256
|
-
rescue
|
257
|
-
color = 7 # Default color
|
258
|
-
end
|
259
|
-
return color.to_i, bold
|
260
|
-
end
|
261
286
|
def syntax_highlight(input) # SYNTAX HIGHLIGHTING FROM ANSI COLOR CODES
|
262
287
|
color_ary = color_parse(input)
|
263
288
|
color_ary.each do | pair |
|
@@ -274,13 +299,15 @@ def syntax_highlight(input) # SYNTAX HIGHLIGHTING FROM ANSI COLOR CODES
|
|
274
299
|
end
|
275
300
|
end
|
276
301
|
def color_parse(input) # PARSE ANSI COLOR SEQUENCES
|
277
|
-
input.gsub!(
|
278
|
-
input.gsub!(
|
279
|
-
input.gsub!(
|
280
|
-
input.gsub!(
|
281
|
-
input.gsub!(
|
302
|
+
input.gsub!(/\e\[\d;38;5;(\d+);*(\d*)m/, '¤¤\1¤¤\2¤¤')
|
303
|
+
input.gsub!(/\e\[38;5;(\d+);*(\d*)m/, '¤¤\1¤¤\2¤¤')
|
304
|
+
input.gsub!(/\e\[\d;38;2;(\d+);*(\d*);\d*m/, '¤¤\1¤¤\2¤¤')
|
305
|
+
input.gsub!(/\e\[38;2;(\d+);*(\d*);\d*m/, '¤¤\1¤¤\2¤¤')
|
306
|
+
input.gsub!(/\e\[\d+;(\d+);*(\d*)m/, '¤¤\1¤¤\2¤¤')
|
307
|
+
input.gsub!(/\e\[0m/, "")
|
282
308
|
color_array = input.split("¤¤")
|
283
309
|
color_array = color_array.drop(1)
|
310
|
+
#color_array.map! { |x| x || 0 }
|
284
311
|
output = color_array.each_slice(3).to_a
|
285
312
|
return output
|
286
313
|
end
|
@@ -926,7 +953,8 @@ end
|
|
926
953
|
def get_files(win) # The core of the directory listings
|
927
954
|
ls_cmd = "ls 2>/dev/null #{@lsbase} #{@lsall} #{@lsorder} #{@lsinvert} #{@lsuser}" # Get files in current directory
|
928
955
|
ls_cmd += @selected_safe if win == "right"
|
929
|
-
@
|
956
|
+
@cfiles = `#{ls_cmd} --color`.split("\n")
|
957
|
+
@files = @cfiles.map {|f| f.sub(/^\e\[.*\dm(..*$)/, '\1').sub(/\e.+/, '')}
|
930
958
|
ls_cmd += " -H " if win == "right"
|
931
959
|
ls_cmd += %q[ -lh --time-style="long-iso" | awk '{printf "%s%s%s%11s%6s%6s", $1, " " $3, ":" $4,$6,$7,$5"\n"}']
|
932
960
|
@fspes = `#{ls_cmd}`.split("\n").drop(1)
|
@@ -993,7 +1021,8 @@ def list_dir(active) # LIST CONTENT OF A DIRECTORY (BOTH active AND RIGHT WINDOW
|
|
993
1021
|
@cont = ""
|
994
1022
|
end
|
995
1023
|
while ix < @files.size and t < win.maxy do
|
996
|
-
str
|
1024
|
+
str = @files[ix]
|
1025
|
+
cstr = @cfiles[ix]
|
997
1026
|
active ? str_path = str : str_path = "#{@selected}/#{str}"
|
998
1027
|
begin # Add items matching @tag to @tagged
|
999
1028
|
if str.match(/#{@tag}/) and @tag != false
|
@@ -1002,25 +1031,9 @@ def list_dir(active) # LIST CONTENT OF A DIRECTORY (BOTH active AND RIGHT WINDOW
|
|
1002
1031
|
end
|
1003
1032
|
rescue
|
1004
1033
|
end
|
1005
|
-
# Determine the filetype of the item
|
1006
|
-
ftype = ""
|
1007
|
-
ftype = str.match(/\.([^.]*$)/)[1] if str.match?(/\.([^.]*$)/)
|
1008
|
-
# Set special filetypes (sequence matters)
|
1009
|
-
ftype = "bd" if File.blockdev?(str_path)
|
1010
|
-
ftype = "cd" if File.chardev?(str_path)
|
1011
|
-
ftype = "pi" if File.pipe?(str_path)
|
1012
|
-
ftype = "st" if File.sticky?(str_path)
|
1013
|
-
ftype = "so" if File.socket?(str_path)
|
1014
|
-
ftype = "ex" if File.executable?(str_path)
|
1015
|
-
ftype = "di" if File.directory?(str_path)
|
1016
|
-
ftype = "ln" if File.symlink?(str_path)
|
1017
|
-
begin
|
1018
|
-
File.stat(str_path) # Checking if not an orphaned link
|
1019
|
-
rescue
|
1020
|
-
ftype = "or" # Set to orphant if no link target
|
1021
|
-
end
|
1022
1034
|
fg = 7; bold = 0; bg = 0 # Set default color
|
1023
|
-
|
1035
|
+
fl = color_parse(cstr)
|
1036
|
+
fg, bold = fl[0][0].to_i, fl[0][1].to_i unless fl[0] == nil
|
1024
1037
|
init_pair(fg, fg, bg)
|
1025
1038
|
file_marker = color_pair(fg)
|
1026
1039
|
file_marker = file_marker | Curses::A_BOLD if bold == 1
|
@@ -1674,7 +1687,7 @@ loop do # OUTER LOOP - CATCHING REFRESHES VIA 'r'
|
|
1674
1687
|
close_screen
|
1675
1688
|
# If launched via the script "r", return current dir and "r" will cd to that
|
1676
1689
|
begin
|
1677
|
-
File.write(ARGV[0], Dir.pwd) if ARGV[0] and ARGV[0].match(/\/tmp
|
1690
|
+
File.write(ARGV[0], Dir.pwd) if ARGV[0] and ARGV[0].match(/\/tmp/)
|
1678
1691
|
rescue
|
1679
1692
|
end
|
1680
1693
|
end
|
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: 3.
|
4
|
+
version: '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: 2023-05-
|
11
|
+
date: 2023-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: curses
|
@@ -47,14 +47,15 @@ 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 3.
|
50
|
+
other features. New in 3.8: Rewrite of core file listing engine for speedup. RTFM
|
51
|
+
now handles simpler LS_COLORS. You can now supply a path as argument at startup
|
52
|
+
to let RTFM start from that directory.'
|
51
53
|
email: g@isene.com
|
52
54
|
executables:
|
53
55
|
- rtfm
|
54
56
|
extensions: []
|
55
57
|
extra_rdoc_files: []
|
56
58
|
files:
|
57
|
-
- ".rtfm.launch"
|
58
59
|
- README.md
|
59
60
|
- bin/rtfm
|
60
61
|
- rtfm-kb.png
|
data/.rtfm.launch
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
# This function starts RTFM and will cd to the exit dir
|
2
|
-
#
|
3
|
-
# Add this line to your .bashrc or .zshrc to make RTFM exit to the
|
4
|
-
# current directory by launching the file manager via r in the terminal:
|
5
|
-
# source ~/.rtfm.launch
|
6
|
-
# ... and place the file .rtfm.launch in your home directory.
|
7
|
-
# With this, you can jump around in your directory structure via RTFM, exit to
|
8
|
-
# the desired directory, do work in the terminal and go back into RTFM via r.
|
9
|
-
|
10
|
-
function r {
|
11
|
-
f=$(mktemp)
|
12
|
-
(
|
13
|
-
set +e
|
14
|
-
rtfm "$f"
|
15
|
-
code=$?
|
16
|
-
if [ "$code" != 0 ]; then
|
17
|
-
rm -f "$f"
|
18
|
-
exit "$code"
|
19
|
-
fi
|
20
|
-
)
|
21
|
-
code=$?
|
22
|
-
if [ "$code" != 0 ]; then
|
23
|
-
return "$code"
|
24
|
-
fi
|
25
|
-
d=$(<"$f")
|
26
|
-
rm -f "$f"
|
27
|
-
cd "$d"
|
28
|
-
}
|