npm install console-gui
const ConsoleGUI = require("console-gui");
const app = new ConsoleGUI();
app.name("foo")
.version("1.0.0")
.motd("Welcome message!")
.logo(" <= FOO => ");
app.run();
app
.name("TESTING")
.version("1.101.2")
.motd("Message Of The Day!")
app.addCommand("hello")
.action(() => {
console.log("world")
})
app.addCommand("say <message>")
.description("Say something to the world!")
.action(messages => {
console.log(messages);
})
app.run();
Sets the name for the program or app:
string
The name to usereturns
ConsoleGUI Object
app.name("bar");
Sets the version of the program or app:
string
The version to usereturns
ConsoleGUI Object
app.version("1.2.3");
Sets the welcome message:
string
The message to usereturns
ConsoleGUI Object
app.motd("Welcome message!");
Sets the logo for the program or app. If it's a string, just the string will be printed, but if it's a function, the function will be executed and when the callback is called the program or app will then start.
string
The string of the logofunction
A function with a callbackreturns
ConsoleGUI Object
app.logo(" <= FOO => ");
app.logo(callback => {
// Print your logo or do something...
callback();
})
Start the app or program
app.run();
Add a command to your app:
string
Command to be addedreturns
Command Object
app.addCommand("foo");
Sets the description of the command
string
The description of the commandreturns
Command Object
app.addCommand("foo")
.description("bar")
function
The function that will run when the command is executedreturns
Command Object
app.addCommand("foo <arg>")
.action(arg => {
console.log(arg);
})