nodejs-cli-runner
TypeScript icon, indicating that this package has built-in type declarations

1.2.2 • Public • Published

Nodejs CLI Runner

CLI Task Run Utilities for NodeJs

Install

npm i nodejs-cli-runner

Configure a set of Sub Commands

Read and write common file types with cached storage

import { rootCommand } from "nodejs-cli-runner";

const program = rootCommand("cmd-name", [
  // set of sub commands
]);

export default program;

To run a task within the command action

import { taskRunner } from "nodejs-cli-runner";

await taskRunner(
  taskName, // taskname
  task, // function returning a Promise
  options, // boolean or {verbose: boolean, progressIndicator: boolean} to print more verbose logs and enable progressIndicator
  ...taskArgs // arguments to task function
);

Run a child Process

import { childProcess } from "nodejs-cli-runner";

await childProcess(
  dir, // dir to run child process on
  command, // command/ program to execute
  args, // program arguments
  stdout // stdout config,
  stderr: // stderr config,
  prefix?: // prefix string to prefix in all stdout and stderr lines
);

Support

This project is a part of the Open Source Initiative from Sodaru Technologies

Write an email to opensource@sodaru.com for queries on this project

Package Sidebar

Install

npm i nodejs-cli-runner

Weekly Downloads

13

Version

1.2.2

License

MIT

Unpacked Size

29.5 kB

Total Files

18

Last publish

Collaborators

  • sodaru-it