Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

inquirer

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

inquirer

  • 0.2.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

inquirer.rb

Build Status

Interactive user prompts on CLI for ruby.

Prompt types

List

idx = Ask.list "Look behind you...", [
  "a three-headed monkey!",
  "a pink pony",
  "Godzilla"
]
# idx is the selected index

List example

Checkbox

Takes optional default property that define the checked options

idx = Ask.checkbox "Monkey see, monkey...", [
  "don't",
  "eats Banana",
  "do"
], default: [true, false, true]
# idx is an array containing the selections

Checkbox example

Input

Takes optional default property (string).

firstname = Ask.input "What's your name"
phone = Ask.input "What's your phone number", default: "123"
# name and phone are the responses for each question

Input example

Confirm

Takes optional default property (true or false). The default default value is true.

value = Ask.confirm "Are you sure?"
# value is a boolean

Ask.confirm "Are you sure?", default: false
# Default is false

Input example

Options

Method parameters

  • question: string The text to your are going to ask
  • elements: array Array of options to show. Only for checkbox and list types.

Rendering options

You can pass this options as the lastest parameter

  • clear: bool [Default true] Clear the original question after pressing enter
  • response: bool [Default true] Whether to show the selected response
# If you dont want any output use
Ask.input "What's your name", response: false

# If you don't want the response and you want to keep the question prompt
Ask.input "What's your name", clear: false, response: false

Installation

gem install inquirer

Compatibility

RubyLinuxOS XWindows
MRI 1.9.3
MRI 2.0.x
MRI 2.1.x
MRI 2.2.x
Rubinius 2.5.x
JRuby 1.7.x

Contributors

Thank you for contributing!

Credit

This is basically the wonderful Inquirer.js, just done for ruby. I was unable to find a good gem to handle user interaction in ruby as well as this module does in JS.

License

Apache v2 Author: Dominik Richter

FAQs

Package last updated on 26 May 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc