Socket
Book a DemoInstallSign in
Socket

cliprompt

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cliprompt

0.1.2
bundlerRubygems
Version published
Maintainers
1
Created
Source

Cliprompt

Gem Version Downloads Build Status Coverage Status Dependency Status Code Climate Inch CI

This library provides a simple DSL for managing user interaction in a CLI application. Still under development, but usable already. Check the Changelog to see what is in already.

Features

  • manages questions, choices, default values, yes/no values (done)
  • makes possible to have env vars set for defaults (done)

Usage

# add in your Gemfile
gem 'cliprompt'

Then in your code

require 'cliprompt'

class Myclass
  extend Cliprompt

  def initialize
    @url = ask "What is the url of Myclass?"
    @ssl = ask "Is it using SSL?", 'y/N'
    @age = ask "What is the age of the captain?", [22,33,=44,55]
    # if you set set ENV['SOMEVAR'], it will override the answer and won't display the question
    # in such case you still can use normal options and nev var will be validated against it (for boolean or choices setup)
    @age = guess 'SOMEVAR', "What is the age of the captain?", [22,33,=44,55]
  end
end

Check example.rb for various possible combinations, or run rspec -f d after all that's also what tests are for.

Contributing

License

Copyrite (c) 2014 - mose - Distributed under MIT license

FAQs

Package last updated on 20 Nov 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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.