Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/derhuerst/tiny-cli-editor
A nano-like command line editor.
https://github.com/derhuerst/tiny-cli-editor
cli editor prompt
Last synced: about 1 month ago
JSON representation
A nano-like command line editor.
- Host: GitHub
- URL: https://github.com/derhuerst/tiny-cli-editor
- Owner: derhuerst
- License: isc
- Created: 2017-01-20T20:47:10.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-10-22T10:35:18.000Z (over 6 years ago)
- Last Synced: 2024-12-25T00:30:11.046Z (about 2 months ago)
- Topics: cli, editor, prompt
- Language: JavaScript
- Homepage: https://github.com/derhuerst/tiny-cli-editor
- Size: 10.7 KB
- Stars: 14
- Watchers: 2
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license.md
Awesome Lists containing this project
README
# tiny-cli-editor
**A nano-like command line editor.** Really basic, but very lightweight. Can be used as a programmatically from JS.
[](https://asciinema.org/a/100110)
The following features are missing, but I'd like to implement them in the future:
- copy to clipboard, paste from it
- ask for confirmation on `ctrl+c`I won't implement these features:
- syntax highlighting
- panels/bars/overlays
- mouse support
- plugin system[](https://www.npmjs.com/package/tiny-cli-editor)
[](https://david-dm.org/derhuerst/tiny-cli-editor)

[](https://gitter.im/derhuerst)
[](https://patreon.com/derhuerst)*tiny-cli-editor* uses [*prompt-skeleton*](https://github.com/derhuerst/prompt-skeleton) to have a behavior consistent with [other prompts](https://github.com/derhuerst/prompt-skeleton#prompts-using-prompt-skeleton).
## Installing
```shell
npm install tiny-cli-editor # to use it as a library
npm install -g tiny-cli-editor # to use it from the shell
```## Usage
```shell
editor index.js
````Ctrl + C` to abort, `Ctrl + D` to save the file.
To use *tiny-cli-editor* programmatically:
```js
const editor = require('tiny-cli-editor')editor('Hello this is dog.')
.on('data', (text) => {
// do something with the text
})
.on('abort', (text) => {
// do something with the text
})
.on('submit', (text) => {
// do something with the text
})
```## Related
- [`date-prompt`](https://github.com/derhuerst/date-prompt)
- [`mail-prompt`](https://github.com/derhuerst/mail-prompt)
- [`multiselect-prompt`](https://github.com/derhuerst/multiselect-prompt)
- [`number-prompt`](https://github.com/derhuerst/number-prompt)
- [`range-prompt`](https://github.com/derhuerst/range-prompt)
- [`select-prompt`](https://github.com/derhuerst/select-prompt)
- [`text-prompt`](https://github.com/derhuerst/text-prompt)
- [`tree-select-prompt`](https://github.com/derhuerst/tree-select-prompt)
- [`cli-autocomplete`](https://github.com/derhuerst/cli-autocomplete)
- [`switch-prompt`](https://github.com/derhuerst/switch-prompt)## Contributing
If you **have a question**, **found a bug** or want to **propose a feature**, have a look at [the issues page](https://github.com/derhuerst/location/issues).