Module: Tty Private
- Defined in:
- utils/tty.rb,
sorbet/rbi/dsl/tty.rbi
Overview
This module is part of a private API. This module may only be used in the Homebrew/brew repository. Third parties should avoid using this module if possible, as it may be removed or changed without warning.
DO NOT EDIT MANUALLY
This is an autogenerated file for dynamic methods in Tty
.
Please instead update this file by running bin/tapioca dsl Tty
.
Constant Summary collapse
- COLOR_CODES =
This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.
{ red: 31, green: 32, yellow: 33, blue: 34, magenta: 35, cyan: 36, default: 39, }.freeze
- STYLE_CODES =
This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.
{ reset: 0, bold: 1, italic: 3, underline: 4, strikethrough: 9, no_underline: 24, }.freeze
- SPECIAL_CODES =
This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.
{ up: "1A", down: "1B", right: "1C", left: "1D", erase_line: "K", erase_char: "P", }.freeze
- CODES =
This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.
COLOR_CODES.merge(STYLE_CODES).freeze
Class Method Summary collapse
- .blue ⇒ String private
- .bold ⇒ String private
- .color? ⇒ Boolean private
- .current_escape_sequence ⇒ String private
- .cyan ⇒ String private
- .default ⇒ String private
- .down ⇒ String private
- .erase_char ⇒ String private
- .erase_line ⇒ String private
- .green ⇒ String private
- .italic ⇒ String private
- .left ⇒ String private
- .magenta ⇒ String private
- .no_underline ⇒ String private
- .red ⇒ String private
- .reset ⇒ String private
- .reset_escape_sequence! ⇒ void private
- .right ⇒ String private
- .strikethrough ⇒ String private
- .strip_ansi(string) ⇒ String private
- .truncate(string) ⇒ String private
- .underline ⇒ String private
- .up ⇒ String private
- .width ⇒ Integer private
- .with(stream, &_block) ⇒ void private
- .yellow ⇒ String private
Class Method Details
.blue ⇒ String
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
10 |
# File 'sorbet/rbi/dsl/tty.rbi', line 10 def blue; end |
.bold ⇒ String
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
13 |
# File 'sorbet/rbi/dsl/tty.rbi', line 13 def bold; end |
.color? ⇒ Boolean
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
111 112 113 114 115 116 |
# File 'utils/tty.rb', line 111 def color? return false if Homebrew::EnvConfig.no_color? return true if Homebrew::EnvConfig.color? @stream.tty? end |
.current_escape_sequence ⇒ String
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
72 73 74 75 76 |
# File 'utils/tty.rb', line 72 def current_escape_sequence return "" if @escape_sequence.nil? "\033[#{@escape_sequence.join(";")}m" end |
.cyan ⇒ String
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
16 |
# File 'sorbet/rbi/dsl/tty.rbi', line 16 def cyan; end |
.default ⇒ String
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
19 |
# File 'sorbet/rbi/dsl/tty.rbi', line 19 def default; end |
.down ⇒ String
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
22 |
# File 'sorbet/rbi/dsl/tty.rbi', line 22 def down; end |
.erase_char ⇒ String
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
25 |
# File 'sorbet/rbi/dsl/tty.rbi', line 25 def erase_char; end |
.erase_line ⇒ String
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
28 |
# File 'sorbet/rbi/dsl/tty.rbi', line 28 def erase_line; end |
.green ⇒ String
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
31 |
# File 'sorbet/rbi/dsl/tty.rbi', line 31 def green; end |
.italic ⇒ String
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
34 |
# File 'sorbet/rbi/dsl/tty.rbi', line 34 def italic; end |
.left ⇒ String
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
37 |
# File 'sorbet/rbi/dsl/tty.rbi', line 37 def left; end |
.magenta ⇒ String
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
40 |
# File 'sorbet/rbi/dsl/tty.rbi', line 40 def magenta; end |
.no_underline ⇒ String
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
43 |
# File 'sorbet/rbi/dsl/tty.rbi', line 43 def no_underline; end |
.red ⇒ String
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
46 |
# File 'sorbet/rbi/dsl/tty.rbi', line 46 def red; end |
.reset ⇒ String
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
49 |
# File 'sorbet/rbi/dsl/tty.rbi', line 49 def reset; end |
.reset_escape_sequence! ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
This method returns an undefined value.
79 80 81 |
# File 'utils/tty.rb', line 79 def reset_escape_sequence! @escape_sequence = nil end |
.right ⇒ String
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
52 |
# File 'sorbet/rbi/dsl/tty.rbi', line 52 def right; end |
.strikethrough ⇒ String
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
55 |
# File 'sorbet/rbi/dsl/tty.rbi', line 55 def strikethrough; end |
.strip_ansi(string) ⇒ String
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
52 53 54 |
# File 'utils/tty.rb', line 52 def strip_ansi(string) string.gsub(/\033\[\d+(;\d+)*m/, "") end |
.truncate(string) ⇒ String
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
67 68 69 |
# File 'utils/tty.rb', line 67 def truncate(string) (w = width).zero? ? string.to_s : (string.to_s[0, w - 4] || "") end |
.underline ⇒ String
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
58 |
# File 'sorbet/rbi/dsl/tty.rbi', line 58 def underline; end |
.up ⇒ String
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
61 |
# File 'sorbet/rbi/dsl/tty.rbi', line 61 def up; end |
.width ⇒ Integer
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
57 58 59 60 61 62 63 64 |
# File 'utils/tty.rb', line 57 def width @width ||= begin _, width = `/bin/stty size 2>/dev/null`.split width, = `/usr/bin/tput cols 2>/dev/null`.split if width.to_i.zero? width ||= 80 width.to_i end end |
.with(stream, &_block) ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
This method returns an undefined value.
42 43 44 45 46 47 48 49 |
# File 'utils/tty.rb', line 42 def with(stream, &_block) previous_stream = @stream @stream = stream yield stream ensure @stream = previous_stream end |
.yellow ⇒ String
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
64 |
# File 'sorbet/rbi/dsl/tty.rbi', line 64 def yellow; end |