Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
improvement in README.md and gif added.
  • Loading branch information
jjoaovitor7 committed Dec 25, 2023
commit d5fdea9decd27b2e1975e60f59387b2a91478ac6
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

<p align="center">
Simple and interactive solution to provide a list of selectable items on the command line.
<img src="https://cyrilwanner.github.io/packages/cli-select/assets/preview.gif" alt="cli-select preview">
</p>

> Note: cli-select does not produce colored output by default to keep the dependencies at a minimum. See the [examples](#examples) below on how to reproduce this preview.
Expand All @@ -29,8 +28,7 @@ npm install --save cli-select
## Usage

```javascript
const cliSelect = require('cli-select');

import cliSelect from 'cli-select';
cliSelect(options, callback);
```

Expand Down Expand Up @@ -161,23 +159,25 @@ These two packages are also used in the examples below but `cli-select` is also

### Custom value renderer

![Example](./example.gif)

```javascript
const cliSelect = require('cli-select');
const chalk = require('chalk');
import cliSelect from 'cli-select';
import chalk from 'chalk';

cliSelect({
values: ['Major', 'Minor', 'Patch'],
valueRenderer: (value, selected) => {
if (selected) {
return chalk.underline(value);
}

return value;
},
}).then(...);
```
values: ['Major', 'Minor', 'Patch'],
valueRenderer: (value, selected) => {
if (selected) {
return chalk.underline(value);
}

Todo: more examples, also the one in the preview gif
return value;
},
}).then((option) => {
console.log(`Option selected: ${option.value}`)
});
```

## License

Expand Down
Binary file added example.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.