-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Overhaul IO gate structure 1. Move IO related classes to `lib/reline/io/` directory. 2. Rename `GeneralIO` to `Dumb`. 3. Use IO classes as instances instead of classes. * Update lib/reline/io/ansi.rb Co-authored-by: tomoya ishida <tomoyapenguin@gmail.com> --------- Co-authored-by: tomoya ishida <tomoyapenguin@gmail.com>
- Loading branch information
Showing
13 changed files
with
366 additions
and
338 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
|
||
module Reline | ||
class IO | ||
RESET_COLOR = "\e[0m" | ||
|
||
def self.decide_io_gate | ||
if ENV['TERM'] == 'dumb' | ||
Reline::Dumb.new | ||
else | ||
require 'reline/io/ansi' | ||
|
||
case RbConfig::CONFIG['host_os'] | ||
when /mswin|msys|mingw|cygwin|bccwin|wince|emc/ | ||
require 'reline/io/windows' | ||
io = Reline::Windows.new | ||
if io.msys_tty? | ||
Reline::ANSI.new | ||
else | ||
io | ||
end | ||
else | ||
if $stdout.tty? | ||
Reline::ANSI.new | ||
else | ||
Reline::Dumb.new | ||
end | ||
end | ||
end | ||
end | ||
|
||
def dumb? | ||
false | ||
end | ||
|
||
def win? | ||
false | ||
end | ||
|
||
def reset_color_sequence | ||
self.class::RESET_COLOR | ||
end | ||
end | ||
end | ||
|
||
require 'reline/io/dumb' |
Oops, something went wrong.