rtfm-filemanager 5.1 → 5.1.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/README.md +57 -1
- data/bin/rtfm +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65f531af0c85c52e34c30c9c519d1e6a18805b4a14dc164db763b2222ccdb47b
|
4
|
+
data.tar.gz: e33f6bca4bf995ec4409788943ebeb201835d6688d491df5373cbec567947131
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26bfb3dec1c73fb827cab5546463dffc2b08e248e5c626ba94d5fe41ad5ad7caaf5adb9f2ec81d76599d4de98132fd66e5fda4427f86723eda26361e6736e343
|
7
|
+
data.tar.gz: 20521351d0b775b30a7cad7d97d40973df535fb5299fa35b0744ed45b5d7f4c1a4fc42c418657d504cd7642885fad0c09e9a0a035c5280efc4687144797add39
|
data/README.md
CHANGED
@@ -473,7 +473,7 @@ RTFM by following the instructions in `keys.rb`:
|
|
473
473
|
# KEYMAP['X'] = :my_handler
|
474
474
|
#
|
475
475
|
# def my_handler(chr)
|
476
|
-
# # anything you
|
476
|
+
# # anything you like - use @pB, @pR, Dir.pwd, etc.
|
477
477
|
# @pB.say("You pressed X!")
|
478
478
|
# end
|
479
479
|
#
|
@@ -488,8 +488,64 @@ RTFM by following the instructions in `keys.rb`:
|
|
488
488
|
# @pB.say("ZAPPED!")
|
489
489
|
# end
|
490
490
|
```
|
491
|
+
Here is another example of what you could add as a plugin:
|
492
|
+
```
|
493
|
+
KEYMAP['C-G'] = :git_update
|
494
|
+
|
495
|
+
def git_update
|
496
|
+
@pR.say("Updating...")
|
497
|
+
message = @pCmd.ask('Commit message: ', '')
|
498
|
+
shellexec("git add . && git commit -m '#{message}' && git push")
|
499
|
+
@pB.full_refresh
|
500
|
+
end
|
501
|
+
```
|
491
502
|
***With this, you can mold RTFM to fit your needs better.***
|
492
503
|
|
504
|
+
When writing plugins, there are a few variables you should know:
|
505
|
+
|
506
|
+
Variable | Description
|
507
|
+
----------|------------------------------------------------------------------
|
508
|
+
@pT | Top pane (info bar)
|
509
|
+
@pL | Left pane
|
510
|
+
@pR | Right pane
|
511
|
+
@pB | Bottom pane (status bar)
|
512
|
+
@pCmd | Command pane (asking for commands to execute)
|
513
|
+
@pSearch | Search pane (prompting for what to search for)
|
514
|
+
@pAI | Pane for interacting with (Open)AI
|
515
|
+
@pRuby | Ruby debug/command pane
|
516
|
+
@selected | The selected item in the Left pane
|
517
|
+
|
518
|
+
Here are three importan hook-ins to use with your plugins:
|
519
|
+
|
520
|
+
### Summary of overlap & choice
|
521
|
+
- **Use `command`** when you need to _capture_ output as a value (and optionally handle stderr yourself).
|
522
|
+
- **Use `shell`** for fire-and-forget side-effects where you don't care about stdout but still want error reporting.
|
523
|
+
- **Use `shellexec`** when you want both stdout and stderr printed into RTFM's Right pane automatically.
|
524
|
+
|
525
|
+
#### `command(cmd, timeout: 5, return_both: false) → String or [stdout, stderr]`
|
526
|
+
- **What it does:** Runs `bash -c cmd`, captures both stdout and stderr, enforces a timeout.
|
527
|
+
- **When to use:** Programmatically grab output (and optionally errors) of a shell command (e.g. building directory listings or previews).
|
528
|
+
- **Key points:**
|
529
|
+
- By default prints stderr into the Right pane and returns stdout.
|
530
|
+
- `return_both: true` returns `[stdout, stderr]` instead of auto-printing errors.
|
531
|
+
- Times out after `timeout` seconds, killing the process if necessary.
|
532
|
+
|
533
|
+
#### `shell(cmd, background: false, err: nil) → nil`
|
534
|
+
- **What it does:** Fires off `cmd` via `system`, redirecting stderr into a log file (default: `$TMP/rtfm_err.log`), optionally in the background.
|
535
|
+
- **When to use:** Run side-effecting commands (e.g. `xdg-open`, `mv`) where you don't need stdout but still want error reporting.
|
536
|
+
- **Key points:**
|
537
|
+
- If `background: true`, runs `cmd &`.
|
538
|
+
- Any stderr output is read from the log and shown via `@pR.say`.
|
539
|
+
- Doesn't return command output, errors only.
|
540
|
+
|
541
|
+
#### `shellexec(cmd, timeout: 10) → nil`
|
542
|
+
- **What it does:** A thin wrapper over `command(cmd, timeout:, return_both: true)` that _always_ prints both stdout and stderr into the Right pane.
|
543
|
+
- **When to use:** Run a command and echo both its stdout and any errors back to the user—e.g. interactive grep, locate, or other one-off shell tools.
|
544
|
+
- **Key points:**
|
545
|
+
- Internally calls `command(..., return_both: true)`.
|
546
|
+
- Prints stderr first, then stdout.
|
547
|
+
- Doesn't return anything to the caller.
|
548
|
+
|
493
549
|
## Screencast
|
494
550
|
Here's a screencast for an early version of RTFM, but it shows the basic stuff:
|
495
551
|
[](https://youtu.be/ANUOlDryUng)
|
data/bin/rtfm
CHANGED
@@ -1574,7 +1574,7 @@ def dirlist(left: true) # LIST DIRECTORIES {{{2
|
|
1574
1574
|
end
|
1575
1575
|
# Map & decorate each colored line
|
1576
1576
|
ls.map!.with_index do |el, i|
|
1577
|
-
n = el.clean_ansi
|
1577
|
+
n = el.to_s.clean_ansi
|
1578
1578
|
n = n.shorten(width - 5).inject('…', -1) if n.pure.length > width - 6
|
1579
1579
|
raw_name = (purels[i] || '').strip
|
1580
1580
|
base = left ? Dir.pwd : dir
|
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: 5.1.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: 2025-
|
11
|
+
date: 2025-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rcurses
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '7.4'
|
55
55
|
description: |-
|
56
56
|
Major release - RTFM v5: Complete rewrite using rcurses (https://github.com/isene/rcurses). Massive improvements. AI integration.
|
57
|
-
A full featured terminal browser with syntax highlighted files, images shown in the terminal, videos thumbnailed, etc. You can bookmark and jump around easily, delete, rename, copy, symlink and move files. RTFM is one of the most feature-packed terminal file managers. 5.1:
|
57
|
+
A full featured terminal browser with syntax highlighted files, images shown in the terminal, videos thumbnailed, etc. You can bookmark and jump around easily, delete, rename, copy, symlink and move files. RTFM is one of the most feature-packed terminal file managers. 5.1.1: Minor bugfix (fixed calling clean_ansi with nil).
|
58
58
|
email: g@isene.com
|
59
59
|
executables:
|
60
60
|
- rtfm
|