1.1.5 • Published 5 months ago
cli-active-table v1.1.5
cli-active-table
Is an npm package for Node.js CLI applications that provides interactive tables with keyboard navigation, preview, and support for rendering multiple lists.
Installation
To install the package, use the one of the following commands depending on you package manager:
npm install cli-active-table
yarn add cli-active-table
pnpm add cli-active-table
Usage
Basic usage
const data = [
{ id: 1, name: 'name1', description: 'description1' },
{ id: 2, name: 'name2', description: 'description2' },
{ id: 3, name: 'name3', description: 'description3' },
];
const table = new ActiveTable([{ data }]);
const result = await table.handle();
console.log(result);
More examples
Use Сases
Gilhub issues
npm run examples:issues
multiple table on one screen
npm run examples:multiple
crypto currencies data from api.coingecko.com
npm run examples:crypto
books list from openlibrary.org
npm run examples:books
space launches data from api.spacexdata.com
npm run examples:launches
Key bindings
Component | Key | Description |
---|---|---|
Any | Ctrl+C | Exit application |
List Section | Tab | Rotate section |
List Section | Shift+Tab | Back rotate section |
List Section | Escape | Return selected data |
List Section | Enter | Open Preview section |
List Section | Space | Select/Deselect row |
List Section | Ctrl+a | Select/Deselect all |
List Section | delete | Delete row |
List Section | Ctrl+f | Enable search mode |
Preview Section | Escape | Close Preview section |
Preview Section | Enter | Close Preview section |
Contributing
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bug fix:
git checkout -b feature-name
- Commit your changes:
git commit -m "Description of changes"
- Push to the branch:
git push origin feature-name
- Submit a pull request.
License
This project is licensed under the MIT License. See the LICENSE file for details.