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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +57 -1
  3. data/bin/rtfm +1 -1
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6bbc6d64124646007a63f55a1893559ed4280b222bc7b22125e3989faada4e3e
4
- data.tar.gz: 7f1df3080c4503c2245cb662a787b23fa2431ee71e4fe3c93fd4e46c0a6c57d6
3
+ metadata.gz: 65f531af0c85c52e34c30c9c519d1e6a18805b4a14dc164db763b2222ccdb47b
4
+ data.tar.gz: e33f6bca4bf995ec4409788943ebeb201835d6688d491df5373cbec567947131
5
5
  SHA512:
6
- metadata.gz: 26798f5fef31aa07c29e9a0ce9433e5515f9dce99a192b0fb5a2ee01e43c82f744d68f696245855701ae7e0f41e341064c40f30e82877eb96de8fc82028f7a10
7
- data.tar.gz: 6fbc30447092da044758ebf632155f9a94a97271558ebdd9d667fee7a8a5c1fa5f07578afe4e0240a2f43193e7361bc1a4fee06abaf810b4ba71729410b322d0
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 likebuse @pB, @pR, Dir.pwd, etc.
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
  [![RTFM screencast](/img/screenshot.png)](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: '5.1'
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-04-30 00:00:00.000000000 Z
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: Fixed a rare bug on opening $EDITOR.
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