1.0.25 • Published 3 years ago

consoleframework v1.0.25

Weekly downloads
7
License
MIT
Repository
-
Last release
3 years ago

Console-Framework

Installation

Use the package manager npm to install console-framework.

npm install consoleframework

Requirements

The console-framework works with the colors and prompt-sync library

Usage

example.js

const consoleClass = require('consoleframework');
const colors = require('colors');

var con = new consoleClass();
con.setInputPrefix('<<'.blue);
con.setOutputPrefix('>>'.blue);
con.setErrorPrefix('<<Error>>'.red);                      

con.createSynatxTree().addSyntaxAst('-say')
                      .addSyntaxAstWithScript('$value', say)
                      .build();

con.createSynatxTree().addSyntaxAst('-calc')
                      .addSyntaxAstWithScript('$value', calc)
                      .build();                      

con.createSynatxTree().addSyntaxAst('-setInput')
                      .addSyntaxAstWithScript('$value', setInput)
                      .build();

con.createSynatxTree().addSyntaxAst('-setOutput')
                      .addSyntaxAstWithScript('$value', setOutput)
                      .build();                      

con.createSynatxTree().addSyntaxAstWithScript('-close', close)
                      .build();                      

con.mainLoop();

function say(value){
    con.log(colors.yellow(value));
}    

function calc(value){
    con.log(colors.green(eval(value)));
}

function setInput(value){
    con.setInputPrefix(colors.rainbow(value));
}

function setOutput(value){
    con.setOutputPrefix(colors.rainbow(value));
}

function close(){
    con.close();
    con.log('Bye bye :D'.cyan);
}

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

Mit

1.0.25

3 years ago

1.0.24

3 years ago

1.0.23

3 years ago

1.0.22

3 years ago

1.0.2

3 years ago

1.0.21

3 years ago

1.0.1

3 years ago