ruby-shell 3.1.0 → 3.2.0
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/PLUGIN_GUIDE.md +757 -0
- data/README.md +64 -1
- data/bin/rsh +433 -36
- metadata +5 -4
data/README.md
CHANGED
|
@@ -33,7 +33,22 @@ Or simply `gem install ruby-shell`.
|
|
|
33
33
|
* All colors are themeable in .rshrc (see github link for possibilities)
|
|
34
34
|
* Copy current command line to primary selection (paste w/middle button) with `Ctrl-y`
|
|
35
35
|
|
|
36
|
-
## NEW in v3.
|
|
36
|
+
## NEW in v3.2.0 - Plugin System & Productivity ⭐⭐⭐
|
|
37
|
+
* **Plugin Architecture**: Extensible plugin system with lifecycle hooks and extension points
|
|
38
|
+
* **Lifecycle Hooks**: on_startup, on_command_before, on_command_after, on_prompt
|
|
39
|
+
* **Extension Points**: add_completions (TAB completion), add_commands (custom commands)
|
|
40
|
+
* **Plugin Management**: `:plugins` list/reload/enable/disable/info commands
|
|
41
|
+
* **Auto-loading**: Plugins in `~/.rsh/plugins/` load automatically on startup
|
|
42
|
+
* **Safe Execution**: Isolated plugin execution with error handling, no shell crashes
|
|
43
|
+
* **Example Plugins**: git_prompt (branch in prompt), command_logger (audit log), kubectl_completion (k8s shortcuts)
|
|
44
|
+
* **Auto-correct Typos**: `:config "auto_correct", "on"` with user confirmation (Y/n) before applying
|
|
45
|
+
* **Command Timing Alerts**: `:config "slow_command_threshold", "5"` warns on commands > 5 seconds
|
|
46
|
+
* **Inline Calculator**: `:calc 2 + 2`, `:calc "Math::PI"` - full Ruby Math library support
|
|
47
|
+
* **Enhanced History**: `!!` (last), `!-2` (2nd to last), `!5:7` (chain commands 5-7)
|
|
48
|
+
* **Stats Visualization**: `:stats --graph` for colorful ASCII bar charts with intensity colors
|
|
49
|
+
* **Documentation**: Complete PLUGIN_GUIDE.md with API reference and examples
|
|
50
|
+
|
|
51
|
+
## v3.1.0 - Quick Wins & Polish ⭐
|
|
37
52
|
* **Multiple Named Sessions**: Save/load different sessions - `:save_session "project"`, `:load_session "project"`
|
|
38
53
|
* **Stats Export**: Export analytics to CSV/JSON - `:stats --csv` or `:stats --json`
|
|
39
54
|
* **Session Auto-save**: Set `@session_autosave = 300` in .rshrc for automatic 5-minute saves
|
|
@@ -108,6 +123,8 @@ Special commands:
|
|
|
108
123
|
* `:bm "-name"` delete bookmark, `:bm "?tag"` search by tag (NEW in v3.0)
|
|
109
124
|
* `:save_session "name"` saves named session, `:load_session "name"` loads session (NEW in v3.0)
|
|
110
125
|
* `:list_sessions` shows all saved sessions, `:rmsession "name"` or `:rmsession "*"` deletes (NEW in v3.1)
|
|
126
|
+
* `:theme "name"` applies color scheme, `:config` manages settings, `:env` manages environment (NEW in v3.1)
|
|
127
|
+
* `:plugins` lists plugins, `:plugins "disable", "name"` disables, `:plugins "reload"` reloads (NEW in v3.2)
|
|
111
128
|
* `:info` shows introduction and feature overview
|
|
112
129
|
* `:version` Shows the rsh version number and the last published gem file version
|
|
113
130
|
* `:help` will display a compact command reference in two columns
|
|
@@ -210,6 +227,52 @@ Ruby functions have access to:
|
|
|
210
227
|
- JSON/XML parsing
|
|
211
228
|
- And everything else Ruby can do!
|
|
212
229
|
|
|
230
|
+
## Plugin System (v3.2.0+)
|
|
231
|
+
|
|
232
|
+
rsh supports a powerful plugin system for extending functionality. Plugins are Ruby classes placed in `~/.rsh/plugins/` that can:
|
|
233
|
+
|
|
234
|
+
- Add custom commands
|
|
235
|
+
- Add TAB completions
|
|
236
|
+
- Hook into command execution (before/after)
|
|
237
|
+
- Modify the prompt
|
|
238
|
+
- Access rsh internals (history, bookmarks, etc.)
|
|
239
|
+
|
|
240
|
+
**Quick Start:**
|
|
241
|
+
```ruby
|
|
242
|
+
# Create ~/.rsh/plugins/hello.rb
|
|
243
|
+
class HelloPlugin
|
|
244
|
+
def initialize(rsh_context)
|
|
245
|
+
@rsh = rsh_context
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
def add_commands
|
|
249
|
+
{
|
|
250
|
+
"hello" => lambda { |*args| "Hello, #{args[0] || 'World'}!" }
|
|
251
|
+
}
|
|
252
|
+
end
|
|
253
|
+
end
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
Then in rsh: `hello Geir` outputs `Hello, Geir!`
|
|
257
|
+
|
|
258
|
+
**Plugin Management:**
|
|
259
|
+
```bash
|
|
260
|
+
:plugins # List all loaded plugins
|
|
261
|
+
:plugins "disable", "git_prompt" # Disable a plugin
|
|
262
|
+
:plugins "enable", "git_prompt" # Enable a plugin
|
|
263
|
+
:plugins "reload" # Reload all plugins
|
|
264
|
+
:plugins "info", "plugin_name" # Show plugin details
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
**Included Example Plugins:**
|
|
268
|
+
- **git_prompt** - Shows current git branch in prompt
|
|
269
|
+
- **command_logger** - Logs all commands with timestamps (`show_log` to view)
|
|
270
|
+
- **kubectl_completion** - Kubernetes shortcuts and completions (k, kns, kctx)
|
|
271
|
+
|
|
272
|
+
**See PLUGIN_GUIDE.md for complete development documentation.**
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
213
276
|
## Integrations
|
|
214
277
|
rsh is integrated with the [rtfm file manager](https://github.com/isene/RTFM), with [fzf](https://github.com/junegunn/fzf) and with the programming language [XRPN](https://github.com/isene/xrpn).
|
|
215
278
|
|