Module: BruteCLI
- Included in:
- ToolOutput::Base
- Defined in:
- lib/brute_cli.rb,
lib/brute_cli/bat.rb,
lib/brute_cli/repl.rb,
lib/brute_cli/emoji.rb,
lib/brute_cli/styles.rb,
lib/brute_cli/spinner.rb,
lib/brute_cli/terminal.rb,
lib/brute_cli/execution.rb,
lib/brute_cli/repl/banner.rb,
lib/brute_cli/tool_output.rb,
lib/brute_cli/cli/commands.rb,
lib/brute_cli/spinner/dots.rb,
lib/brute_cli/spinner/nyan.rb,
lib/brute_cli/buffer_output.rb,
lib/brute_cli/configuration.rb,
lib/brute_cli/repl/commands.rb,
lib/brute_cli/repl/fzf_menu.rb,
lib/brute_cli/repl/user_input.rb,
lib/brute_cli/stream_formatter.rb,
lib/brute_cli/tool_output/read.rb,
lib/brute_cli/tool_output/undo.rb,
lib/brute_cli/cli/commands/chat.rb,
lib/brute_cli/cli_event_handler.rb,
lib/brute_cli/markdown_renderer.rb,
lib/brute_cli/tool_output/fetch.rb,
lib/brute_cli/tool_output/patch.rb,
lib/brute_cli/tool_output/shell.rb,
lib/brute_cli/tool_output/write.rb,
lib/brute_cli/tool_output/remove.rb,
lib/brute_cli/buffer_output/error.rb,
lib/brute_cli/cli/commands/version.rb,
lib/brute_cli/repl/question_screen.rb,
lib/brute_cli/tool_output/delegate.rb,
lib/brute_cli/tool_output/question.rb,
lib/brute_cli/cli/commands/sessions.rb,
lib/brute_cli/tool_output/fs_search.rb,
lib/brute_cli/tool_output/todo_read.rb,
lib/brute_cli/spinner/puff_puff_pass.rb,
lib/brute_cli/tool_output/todo_write.rb,
lib/brute_cli/buffer_output/separator.rb,
lib/brute_cli/buffer_output/stats_bar.rb,
lib/brute_cli/buffer_output/model_line.rb
Defined Under Namespace
Modules: Bat, BufferOutput, CLI, Emoji, Spinner, ToolOutput Classes: CLIEventHandler, Configuration, Execution, MarkdownRenderer, REPL, StreamFormatter, Terminal
Constant Summary collapse
- MONIKER =
<<~MONIKER .o8 . "888 .o8 888oooo. oooo d8b oooo oooo .o888oo .ooooo. d88' `88b `888""8P `888 `888 888 d88' `88b 888 888 888 888 888 888 888ooo888 888 888 888 888 888 888 . 888 .o `Y8bod8P' d888b `V88V"V8P' "888" `Y8bod8P' MONIKER
- THEMES =
Available themes — each maps to a colorize color symbol.
{ "lemon-and-lime" => :yellow, "ganja-king" => :green, "og-treacle" => :magenta, "blues-clues" => :blue, "hot-cheeto" => :light_red, "blue-ice-vape" => :light_magenta, "matrix" => :light_green, "mrs-jackson" => :red, }.freeze
- DEFAULT_THEME =
"lemon-and-lime"- COLOR =
Global accent color — change this one constant to re-theme the entire CLI.
THEMES.fetch(DEFAULT_THEME)
- DIM =
Named color/style constants for use with “string”.colorize(CONST). Compound styles (bold + color, background + foreground) use the hash form.
:grey- ACCENT =
COLOR- ACCENT_BOLD =
{ color: COLOR, mode: :bold }
- ACCENT_BG =
{ color: :black, background: COLOR, mode: :bold }
- ACCENT_BG2 =
{ color: :black, background: COLOR }
- ERROR_BG =
{ color: :white, background: :red, mode: :bold }
- ERROR_FG =
:red
Class Method Summary collapse
-
.apply_theme!(name) ⇒ Object
Re-derive all accent constants from a new color.
- .config ⇒ Object
-
.error(message) ⇒ Object
museum of modern art, bruv…
- .warn(message) ⇒ Object
Class Method Details
.apply_theme!(name) ⇒ Object
Re-derive all accent constants from a new color. Call this before any output (e.g. right after option parsing).
35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/brute_cli/styles.rb', line 35 def self.apply_theme!(name) # honestly what the fuck is this shit??????????? color = THEMES.fetch(name) do raise ArgumentError, "Unknown theme #{name.inspect}. Valid themes: #{THEMES.keys.join(', ')}" end remove_const(:COLOR) ; const_set(:COLOR, color) remove_const(:ACCENT) ; const_set(:ACCENT, color) remove_const(:ACCENT_BOLD) ; const_set(:ACCENT_BOLD, { color: color, mode: :bold }) remove_const(:ACCENT_BG) ; const_set(:ACCENT_BG, { color: :black, background: color, mode: :bold }) remove_const(:ACCENT_BG2) ; const_set(:ACCENT_BG2, { color: :black, background: color }) end |
.config ⇒ Object
11 12 13 |
# File 'lib/brute_cli/configuration.rb', line 11 def self.config @config ||= Configuration.new end |
.error(message) ⇒ Object
museum of modern art, bruv…
20 21 22 |
# File 'lib/brute_cli.rb', line 20 def self.error() $stderr.puts "#{"ERROR".colorize(ERROR_BG)} #{.colorize(ERROR_FG)}" end |
.warn(message) ⇒ Object
24 25 26 |
# File 'lib/brute_cli.rb', line 24 def self.warn() $stderr.puts "warning: #{}".colorize(DIM) end |