Sha256: 94f85b94f9cac4fed760e77f93f4bfddb72da3fec9d648c2a6c7a638534e8763

Contents?: true

Size: 868 Bytes

Versions: 6

Compression:

Stored size: 868 Bytes

Contents

# frozen_string_literal: true
module DiscourseTheme
  class UI
    @@prompt = ::TTY::Prompt.new(help_color: :cyan)
    @@pastel = Pastel.new

    def self.yes?(message)
      @@prompt.yes?(@@pastel.cyan("? ") + message)
    end

    def self.ask(message, default: nil)
      @@prompt.ask(@@pastel.cyan("? ") + message, default: default)
    end

    def self.select(message, options)
      @@prompt.select(@@pastel.cyan("? ") + message, options)
    end

    def self.info(message)
      puts @@pastel.blue("i ") + message
    end

    def self.progress(message)
      puts @@pastel.yellow("» ") + message
    end

    def self.error(message)
      puts @@pastel.red("✘ #{message}")
    end

    def self.warn(message)
      puts @@pastel.yellow("⚠ #{message}")
    end

    def self.success(message)
      puts @@pastel.green("✔ #{message}")
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
discourse_theme-2.1.3 lib/discourse_theme/ui.rb
discourse_theme-2.1.2 lib/discourse_theme/ui.rb
discourse_theme-2.1.1 lib/discourse_theme/ui.rb
discourse_theme-2.1.0 lib/discourse_theme/ui.rb
discourse_theme-2.0.0 lib/discourse_theme/ui.rb
discourse_theme-1.1.0 lib/discourse_theme/ui.rb