function-call-terminal
v1.0.2
Published
A tiny terminal-based function caller utility
Readme
function-call-terminal
A simple terminal application that allows users to call from terminal commands to predefined functions/
Installation
To install the required dependencies, run:
npm install function-call-terminal prompt-syncprompt-sync is used to handle user input in the terminal.
Usage example
Here's a simple example of how to use the function-call-terminal module:
import { functionCallTerminal } from 'function-call-terminal';
const helloFunction = () => {
console.log('Hello, World!');
};
const byeFunction = () => {
console.log('Goodbye, World!');
};
functionCallTerminal({
helloFunction,
byeFunction
});Notice the function get object!!! not array.
When you run this code, it will start a terminal like this:
1. helloFunction
2. byeFunction
Enter the number of the function to execute: When the user enters 1, it will call helloFunction and print Hello, World!. When the user enters 2, it will call byeFunction and print Goodbye, World!.
i hope this helps you to develop your application and check your code easily from terminal. i thought how i do parameter passing also but i didnt know how to do it without get more parameters from user. so if you have any idea please create issue or pull request.
