Intro
Simple command line router that maps command line arguments to javascript function name and params. Very simple mapping at this point (first param is the method name, subsequent ones are passed as param).
Note: From v0.2.x now node.js > 8 is required.
Note: From v0.3.x needs to import as const { router } = require("cmdrouter");
(rather than the 0.2.x const router = require("cmdrouter");
)
usage
testcmd.js
const router = ;// or import { router } from 'cmdrouter' // create a router instance with the name/function dictionary, // and call route() to route from the process.argv; { console;} { console;} { console;} { var a = 12; var b = await ; // returns a promise that will resolve with 8. console;}
From command line:
> node testcmdno command, _default > node testcmd hellowWorldhello world> node testcmd hello JohnHello John> node asyncWorka + b = 20