diff options
author | Stan Lo <[email protected]> | 2024-04-14 19:01:38 +0800 |
---|---|---|
committer | git <[email protected]> | 2024-04-14 11:01:43 +0000 |
commit | 04ba96e619325d6e2c053ae93c2514e9252f0497 (patch) | |
tree | 04b3acfdfc32dc0f11cc81cccd2866c144e6dd08 /lib/irb/command/edit.rb | |
parent | 76b10f2ee1bbc962f2b7f178b7dddb30985d56f7 (diff) |
[ruby/irb] Allow defining custom commands in IRB
(https://github.com/ruby/irb/pull/886)
This is a feature that has been requested for a long time. It is now
possible to define custom commands in IRB.
Example usage:
```ruby
require "irb/command"
class HelloCommand < IRB::Command::Base
description "Prints hello world"
category "My commands"
help_message "It doesn't do more than printing hello world."
def execute
puts "Hello world"
end
end
IRB::Command.register(:hello, HelloCommand)
```
https://github.com/ruby/irb/commit/888643467c
Diffstat (limited to 'lib/irb/command/edit.rb')
-rw-r--r-- | lib/irb/command/edit.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/irb/command/edit.rb b/lib/irb/command/edit.rb index 480100bfc7..3c4a54e5e2 100644 --- a/lib/irb/command/edit.rb +++ b/lib/irb/command/edit.rb @@ -1,5 +1,6 @@ require 'shellwords' +require_relative "../color" require_relative "../source_finder" module IRB |