Skip to content

Parse command-line arguments easily.

Notifications You must be signed in to change notification settings

WangNianyi2001/cli-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cli-js

This is a NodeJS package for quickly implementing a CLI interface for your application. It is written in the ES Module style.

Installation

$ npm i @nianyi-wang/cli

Usage

import { CLI } from '@nianyi-wang/cli';

new CLI({
	options: [
		{
			name: 'out',
			shortNames: 'o',
			argumentCount: 1
		},
	],
	handler() {
		const inSrc = this.arguments[0];
		const outSrc = this.GetSingle('out');
		console.log(`${inSrc} => ${outSrc}`);
	}
}).Execute();