rtfm-filemanager 1.9.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/rtfm +39 -6
- metadata +17 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dddef7180c16901442304eb4525ece982a16a3d6f96ce39258c4acd44db2783b
|
4
|
+
data.tar.gz: cb7411ed3d9c8abf5654893cc4eb5dcad6e1786ccbb15fbc5f3486a75ba9d154
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 756f154772d46ebc46e31cca1e9e44af4cf1ef73a5a136a64e891990bedf1ab8c4708fdc08da8283bb088920c182dc6e7fc24de2a2b757eeedc517d02cb51f26
|
7
|
+
data.tar.gz: d8679cde6f8c897d206c0c489349c5e83636c018ba8a0f599df478e699cd2e0c87eeb07a53ed55492ce914cb3a55308e0ab498de4e1e6ff9aa86871aed732175
|
data/bin/rtfm
CHANGED
@@ -78,6 +78,9 @@ DIRECTORY VIEWS
|
|
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
80
|
S = Show comprehensive system info (system, CPU, filesystem, latest dmesg messages)
|
81
|
+
I = Show OpenAI's description of the selected item and its content (if available)
|
82
|
+
You must have installed the ruby-openai gem and added your openai secret key
|
83
|
+
in the .rtfm.conf (add `@ai = "your-secret-openai-key") for this to work.
|
81
84
|
|
82
85
|
RIGHT PANE
|
83
86
|
ENTER = Refresh the right pane
|
@@ -94,7 +97,7 @@ ADDITINAL COMMANDS
|
|
94
97
|
y = Copy path of selected item to primary selection (for pasting with middle mouse button)
|
95
98
|
Y = Copy path of selected item to clipboard
|
96
99
|
|
97
|
-
COPYRIGHT: Geir Isene, 2020-
|
100
|
+
COPYRIGHT: Geir Isene, 2020-3. No rights reserved. See http://isene.com for more.
|
98
101
|
HELPTEXT
|
99
102
|
|
100
103
|
@firstrun = <<FIRSTRUN
|
@@ -635,6 +638,12 @@ def main_getkey # GET KEY FROM USER
|
|
635
638
|
rescue
|
636
639
|
w_r_info("Unable to show system info")
|
637
640
|
end
|
641
|
+
when 'I'
|
642
|
+
if @ai
|
643
|
+
openai
|
644
|
+
else
|
645
|
+
w_b_info("No OpenAI key in config file. Add `@ai = 'your-secret-openai-key'` to .rtfm.conf")
|
646
|
+
end
|
638
647
|
# RIGHT PANE
|
639
648
|
when 'ENTER' # Refresh right pane
|
640
649
|
@w_r.fill # First clear the window, then clear any previously showing image
|
@@ -1068,11 +1077,8 @@ def w_r_info(info) # SHOW INFO IN THE RIGHT WINDOW
|
|
1068
1077
|
image_show("clear") if @image; @image = false
|
1069
1078
|
@w_r.clr
|
1070
1079
|
@w_r. refresh
|
1071
|
-
w_r_width = Curses.cols - (Curses.cols/@width) -
|
1072
|
-
info
|
1073
|
-
l = []
|
1074
|
-
info.each{ |e| l << e.scan(/.{,#{w_r_width}}/)[0..-2] }
|
1075
|
-
info = l.join("\n")
|
1080
|
+
w_r_width = Curses.cols - (Curses.cols/@width) - 2
|
1081
|
+
info.gsub!(/(.{1,#{w_r_width}})( +|$\n?)|(.{1,#{w_r_width}})/, "\\1\\3\n")
|
1076
1082
|
@w_r.text = info
|
1077
1083
|
@w_r.pager_cmd = ""
|
1078
1084
|
pager_start
|
@@ -1179,6 +1185,32 @@ def var_resets # RESET PAGER VARIABLES
|
|
1179
1185
|
@pager_cmd = ""
|
1180
1186
|
@info = false
|
1181
1187
|
end
|
1188
|
+
def openai # INTERFACE TO OPENAI
|
1189
|
+
begin
|
1190
|
+
require "ruby/openai"
|
1191
|
+
rescue
|
1192
|
+
w_b_info("To make openai work in RTFM, you need to do `gem install ruby-openai` and add this to your .rtfm.conf: $ai = 'your-secret-openai-key'")
|
1193
|
+
end
|
1194
|
+
|
1195
|
+
client = OpenAI::Client.new(access_token: @ai)
|
1196
|
+
|
1197
|
+
c = @w_r.text
|
1198
|
+
@w_r.fg = 214
|
1199
|
+
w_r_info("OpenAI description...")
|
1200
|
+
|
1201
|
+
f = Dir.pwd + "/" + @selected
|
1202
|
+
p = "What is this "
|
1203
|
+
File.directory?(@selected) ? p += "directory: " : p+= "file: "
|
1204
|
+
p += "#{f}? "
|
1205
|
+
p += "Give a brief summary of its content: " + c unless File.directory?(@selected) and c == ""
|
1206
|
+
|
1207
|
+
response = client.completions( parameters: { model: "text-davinci-003", prompt: p, max_tokens: 200 })
|
1208
|
+
text = "OpenAI description:\n" + response["choices"][0]["text"]
|
1209
|
+
|
1210
|
+
@w_r.fg = 229
|
1211
|
+
w_r_info(text)
|
1212
|
+
end
|
1213
|
+
|
1182
1214
|
# BOTTOM WINDOW FUNCTIONS
|
1183
1215
|
def w_b_info(info) # SHOW INFO IN @W_B
|
1184
1216
|
@w_b.clr
|
@@ -1386,6 +1418,7 @@ loop do # OUTER LOOP - CATCHING REFRESHES VIA 'r'
|
|
1386
1418
|
@change = true
|
1387
1419
|
@change_tag = true # For future need to force @change
|
1388
1420
|
loop do # INNER, CORE LOOP
|
1421
|
+
@w_r.text = ""
|
1389
1422
|
begin # Jump to home dir if current dir is externally removed
|
1390
1423
|
Dir.pwd
|
1391
1424
|
rescue
|
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:
|
4
|
+
version: 2.0.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:
|
11
|
+
date: 2023-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: curses
|
@@ -30,11 +30,24 @@ dependencies:
|
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 1.3.2
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: ruby-openai
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '3.0'
|
40
|
+
type: :runtime
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '3.0'
|
33
47
|
description: 'A full featured terminal browser with syntax highlighted files, images
|
34
48
|
shown in the terminal, videos thumbnailed, etc. You can bookmark and jump around
|
35
49
|
easily, delete, rename, copy, symlink and move files. RTFM has a a wide range of
|
36
|
-
other features. New in
|
37
|
-
to confirm) and minor bugfixes on deletion feedback.'
|
50
|
+
other features. New in 2.0.2: Fixed ruby-openai dependency.'
|
38
51
|
email: g@isene.com
|
39
52
|
executables:
|
40
53
|
- rtfm
|