4.3.0 • Published 5 years ago

@phylum/cli v4.3.0

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

Pipeline Cli

Usage

npm i @phylum/cli @phylum/pipeline

# Optional global installation:
npm i -g @phylum/cli
# Basic usage:
phylum [[--run] <modulePath>]
  • --run - Specify the entry module that exports the task to run. Default is ./pipeline

Entry module

The entry module must be a commonjs module that exports a task instance as default:

const { Task } = require('@phylum/pipeline');

export.default = new Task(async () => {
	console.log('Hello World!');
});

Arguments

The entry module can also export an array of argument specs for parsing custom command line arguments:

const { config } = require('@phylum/cli');

exports.default = new Task<void>(async t => {
	// Access parsed arguments:
	const {command} = await t.use(config);
	console.log(command.message);
});

exports.args = [
	{name: 'message', alias: 'm', defaultValue: 'Hello World!'}
];
phylum
# => Hello World!

phylum --message "Foo!"
# => Foo!