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

asking

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

asking

Input utilities for CLI applications

  • 0.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Asking

Tiny utility library for getting user input in CLI programs. Based on prompt and inspired by Ruby's highline gem.

Installation

npm install asking --save

and in your script:

var choose = require('asking').choose;
var ask = require('asking').ask;

Examples

ask

ask ('Enter your email: ', function (err, email) {
	// normal input
});

ask ('Enter your password: ', { hidden: true }, function (err, password) {
	// password will be hidden in console
});

ask ('Enter a color: ', { pattern: /red|green|blue/ }, function (err, color) {
	// color must match /red|green|blue/ regular expression
});

ask ('Enter your name: ', { default: 'John Doe' }, function (err, name) {
	// name defaults to "John Doe"
});

choose

choose ('Select a color', ['red', 'green', 'blue'], function (err, color) {
	// color is one of red, green or blue
});

choose ('Choose your position', {
	junior: 'Junior Developer',
	senior: 'Senior Developer',
	master: 'Kick-ass Developer'
}, function (err, answer, position) {
	// answer is e.g. "Kick-ass Developer"
	// position is "master"
});

License

Asking is released under the MIT License.

FAQs

Package last updated on 04 Dec 2014

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