tiny-cli-editor

0.1.1 • Public • Published

tiny-cli-editor

A nano-like command line editor. Really basic, but very lightweight. Can be used as a programmatically from JS.

asciicast

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

npm version dependency status ISC-licensed chat on gitter support me on Patreon

tiny-cli-editor uses prompt-skeleton to have a behavior consistent with other prompts.

Installing

npm install tiny-cli-editor # to use it as a library 
npm install -g tiny-cli-editor # to use it from the shell 

Usage

editor index.js

Ctrl + C to abort, Ctrl + D to save the file.

To use tiny-cli-editor programmatically:

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

Contributing

If you have a question, found a bug or want to propose a feature, have a look at the issues page.

Dependents (5)

Package Sidebar

Install

npm i tiny-cli-editor

Weekly Downloads

67

Version

0.1.1

License

ISC

Unpacked Size

7.89 kB

Total Files

5

Last publish

Collaborators

  • derhuerst