0.1.1 • Published 6 years ago

tiny-cli-editor v0.1.1

Weekly downloads
8
License
ISC
Repository
github
Last release
6 years ago

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.