rtfm-filemanager 1.9.1 → 2.0.1
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 +39 -6
- metadata +24 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e635485be4c587fdf3d686eb87aa3a26a1727bd790c1fe344e822258b257aeb
|
4
|
+
data.tar.gz: e9a382c8cb1127e147f7fe8c4cd9a53cf3c536a066c512025a60a85d06bf4c5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc524b860652286494db5c20497aca39d8555e2f53eb0da11be96b97575c83931e7d6e6e782c9268544c53686f4b7733b637e9f2c8a7fbd3af1aa0dea828a410
|
7
|
+
data.tar.gz: b0eeb9f5538b2d10e3252ee7852db63642ad70019264f830783c0dde3d9a29611c2d932857b60a4f041717128a78fdf6e5979ac988c196c4e50e2a44b653aa55
|
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.1
|
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-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: curses
|
@@ -30,11 +30,31 @@ dependencies:
|
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 1.3.2
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: rubu-openai
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '3.0'
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 3.0.3
|
43
|
+
type: :runtime
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '3.0'
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 3.0.3
|
33
53
|
description: 'A full featured terminal browser with syntax highlighted files, images
|
34
54
|
shown in the terminal, videos thumbnailed, etc. You can bookmark and jump around
|
35
55
|
easily, delete, rename, copy, symlink and move files. RTFM has a a wide range of
|
36
|
-
other features. New in
|
37
|
-
|
56
|
+
other features. New in 2.0.0: Goddamn! We now have an OpenAI interface for RTFM.
|
57
|
+
Read the doc/helpfile and use key ''I'' and enjoy!'
|
38
58
|
email: g@isene.com
|
39
59
|
executables:
|
40
60
|
- rtfm
|