Class: Cliqr::Command::ShellPromptBuilder Private

Inherits:
Object
  • Object
show all
Includes:
Color
Defined in:
lib/cliqr/command/shell_prompt_builder.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Builds a shell prompt

Instance Method Summary collapse

Methods included from Color

#bg_black, #bg_blue, #bg_cyan, #bg_gray, #bg_green, #bg_magenta, #bg_red, #bg_yellow, #black, #blue, #bold, #cyan, #disable_color, #gray, #green, #magenta, #red, #reverse_color, #yellow

Constructor Details

#initialize(config = nil) ⇒ ShellPromptBuilder

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Create a new shell prompt builder with optional command config



12
13
14
15
# File 'lib/cliqr/command/shell_prompt_builder.rb', line 12

def initialize(config = nil)
  super
  @count = 0
end

Instance Method Details

#build(context) ⇒ String

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Build a prompt for current command

Returns:

  • (String)


20
21
22
23
# File 'lib/cliqr/command/shell_prompt_builder.rb', line 20

def build(context)
  @count += 1
  "[#{cyan(context.command)}][#{@count}] #{bold('$')} "
end