terminal.app
v1.0.1
Published
Create a nodejs console app
Readme
Console.app
Create a nodejs console app
Install
npm i terminal.app # npm
yarn add terminal.app # yarnExample
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()