Skip to content

Commit 4670cbf

Browse files
committed
Use more colors in outputs to the command shell
1 parent 873d3a6 commit 4670cbf

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

lib/ruby_installer/build/msys2_installation.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ class Msys2Installation
77
MSYS2_INSTALL_KEY = "SOFTWARE/Microsoft/Windows/CurrentVersion/Uninstall/"
88
MSYS2_INSTALL_KEY_WOW = "SOFTWARE/WOW6432Node/Microsoft/Windows/CurrentVersion/Uninstall/"
99

10+
include Colors
11+
1012
class MsysNotFound < RuntimeError
1113
end
1214
class CommandError < RuntimeError
@@ -220,7 +222,8 @@ def disable_dll_search_paths
220222
begin
221223
yield
222224
rescue MsysNotFound
223-
$stderr.puts "MSYS2 could not be found. Please run 'ridk install'"
225+
enable_colors # force colors, since this message is also shown, when stdout is redirected by "ridk enable"
226+
$stderr.puts "MSYS2 could not be found. Please run '#{yellow "ridk install"}'"
224227
$stderr.puts "or download and install MSYS2 manually from https://msys2.org/"
225228
exit 1
226229
end

resources/files/startmenu.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
require "ruby_installer/runtime"
22

3+
include RubyInstaller::Runtime::Colors
4+
35
app = RubyInstaller::Runtime::ConsoleUi.new
46
bm = RubyInstaller::Runtime::ConsoleUi::ButtonMatrix.new ncols: 3
57
bm.headline = "Ruby startmenu - Choose item by mouse or cursor keys and press Enter"
@@ -13,7 +15,7 @@
1315
bm.add_button bt do
1416
app.clear_screen
1517
RubyInstaller::Runtime::Ridk.print_logo
16-
puts "\nStarting irb. To show the irb command help, type `help` and press Enter."
18+
puts "\nStarting #{yellow "irb"}. To show the irb command help, type `#{yellow "help"}` and press Enter."
1719
Kernel.system File.join(RbConfig::CONFIG["bindir"], "irb.bat")
1820
end
1921

@@ -53,7 +55,7 @@
5355
EOT
5456
bm.add_button bt do
5557
app.clear_screen
56-
puts "\nRun cmd.exe with ruby environment variables (ridk enable)\n\n"
58+
puts "\nRunning cmd.exe with ruby environment variables (#{yellow "ridk enable"})\n\n"
5759
ridk = File.join(RbConfig::CONFIG["bindir"], "ridk")
5860
Kernel.system "cmd", "/E:ON", "/K", ridk, "enable"
5961
end
@@ -66,7 +68,7 @@
6668
many gems
6769
EOT
6870
bm.add_button bt do
69-
puts "\nInstall MSYS2-Devkit (ridk install)"
71+
puts "\nInstall MSYS2-Devkit (#{yellow "ridk install"})"
7072
ridk = File.join(RbConfig::CONFIG["bindir"], "ridk")
7173
Kernel.system ridk, "install"
7274
end

0 commit comments

Comments
 (0)