From 7cf90549beba1d18ce24a102f2437b31f58681f1 Mon Sep 17 00:00:00 2001 From: AI-Mozi Date: Sat, 31 Aug 2024 13:49:04 +0200 Subject: [PATCH] Upgrade `reline` to `0.4` and add custom color scheme to `RubyShell` --- README.md | 2 +- gemspec.yml | 2 +- lib/ronin/core/cli/ruby_shell.rb | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b61b843..9218077 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ and development. ## Requirements * [Ruby] >= 3.0.0 -* [reline] ~> 0.1 +* [reline] ~> 0.4 * [command_kit] ~> 0.6 * [irb] ~> 1.0 diff --git a/gemspec.yml b/gemspec.yml index ac1f8ee..a1170f6 100644 --- a/gemspec.yml +++ b/gemspec.yml @@ -20,7 +20,7 @@ metadata: required_ruby_version: ">= 3.0.0" dependencies: - reline: ~> 0.1 + reline: ~> 0.4 command_kit: ~> 0.6 irb: ~> 1.0 diff --git a/lib/ronin/core/cli/ruby_shell.rb b/lib/ronin/core/cli/ruby_shell.rb index c321258..84aac16 100644 --- a/lib/ronin/core/cli/ruby_shell.rb +++ b/lib/ronin/core/cli/ruby_shell.rb @@ -99,6 +99,7 @@ def configure IRB.conf[:IRB_NAME] = @name set_prompt + set_completion_dialog end # @@ -141,6 +142,19 @@ def set_prompt end end + # + # Sets colors for the tab-completion menu. + # + # @since 0.3.0 + # + def set_completion_dialog + Reline::Face.config(:completion_dialog) do |conf| + conf.define :default, foreground: :white, background: :black + conf.define :enhanced, foreground: :black, background: :white + conf.define :scrollbar, foreground: :white, background: :black + end + end + end end end