1.0.1 • Published 2 years ago

terminal.app v1.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Console.app

Create a nodejs console app

Install

npm i terminal.app # npm
yarn add terminal.app # yarn

Example

How to configure the package

const { App } = require('terminal.app');
const app = new App({ input_text: "Your text input (ex: >, -> ecc...)" });

app.start()

How to get user input

app.on('input', input => {})

JSON response

{ "content": "text_content" }

Welcome message

app.welcome("text")

OnReady event

app.start(() => {
    // ...
})

Make question

app.question("Text", res => {
    // ...
})

Create command

app.on('input', i => {
    if (i.content === 'hello') {
        console.log('Hello Word!')
    }
})

or

app.addCommand('hello', (i) => {
    console.log("Hello Word!")
})
Code Example
const { App } = require('terminal.app');
const app = new App({ input_text: "-> " });

app.on('input', i => {
    if (i.content === 'hello') {
        console.log('Hello Word!')
    }
})

app.start()
1.0.1

2 years ago

1.0.0

2 years ago