Module: Doing::Prompt

Extended by:
Color
Defined in:
lib/doing/prompt.rb

Overview

Terminal Prompt methods

Constant Summary

Constants included from Color

Color::ATTRIBUTES, Color::ATTRIBUTE_NAMES, Color::COLORED_REGEXP

Class Attribute Summary collapse

Class Method Summary collapse

Methods included from Color

attributes, coloring?, support?, uncolor

Class Attribute Details

.default_answerObject

.force_answerObject

Class Method Details

.choose_from(options, prompt: 'Make a selection: ', multiple: false, sorted: true, fzf_args: []) ⇒ String

Generate a menu of options and allow user selection

Returns:

  • (String)

    The selected option

.choose_from_items(items, **opt) ⇒ Object

Create an interactive menu to select from a set of Items

Parameters:

  • items (Array)

    list of items

  • opt (Hash)

    options

  • include_section (Boolean)

    include section

Options Hash (**opt):

  • :header (String)
  • :prompt (String)
  • :query (String)
  • :show_if_single (Boolean)
  • :menu (Boolean)
  • :sort (Boolean)
  • :multiple (Boolean)
  • :case (Symbol) — default: :sensitive, :ignore, :smart

.fzfObject

.install_fzfObject

Raises:

  • (RuntimeError)

.yn(question, default_response: false) ⇒ Bool

Ask a yes or no question in the terminal

Parameters:

  • question (String)

    The question to ask

  • default_response (Bool) (defaults to: false)

    default response if no input

Returns:

  • (Bool)

    yes or no