# asking

> Input utilities for CLI applications

Latest version **0.1.2** (published 2014-12-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install asking
pnpm add asking
yarn add asking
bun add asking
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2014-12-04 |
| First published | 2014-12-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | Vadim Demedes |
| Maintainers | vdemedes |

## Links

- npm: https://www.npmjs.com/package/asking
- Repository: https://github.com/vdemedes/asking
- Issues: https://github.com/vdemedes/asking/issues
- npm.io page: https://npm.io/package/asking

## Dependencies (1)

- [prompt](https://npm.io/package/prompt.md) ^0.2.14

## Recent versions

- 0.1.2 (latest) — 2014-12-04
- 0.1.1 — 2014-12-04
- 0.1.0 — 2014-12-04

## README

# Asking

Tiny utility library for getting user input in CLI programs. Based on [prompt](https://github.com/flatiron/prompt) and inspired by Ruby's [highline](https://github.com/JEG2/highline) gem.

### Installation

```
npm install asking --save
```

and in your script:

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

## Examples

### ask

```javascript
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

```javascript
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.

---
_Source: https://npm.io/package/asking · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
