README
ArgueTS
TypeScript arguments parser.
Installation (lib)
npm i arguets
or yarn add arguets
(for dev)
- Clone the repo.
- Run
yarn
ornpm i
Usage
Example:
// TypeScript
import ArgueTS, { IOptionDef, IArguments } from "arguets";
const test: string[] = "test 1 2 3 --test OK".split(" ");
const testOpt: IOptionDef = {
name: "test",
alias: "t",
type: "string",
};
const result: IArguments = ArgueTS(test, [testOpt]);
/*
Result:
{
"args": ["test", "1", "2", "3"],
"options": {"test": "OK"}
}
*/
// JavaScript
const ArgueTS = require("arguets");
const test = "test 1 2 3 --test OK".split(" ");
const testOpt = {
name: "test",
alias: "t",
type: "string"
};
const result = ArgueTS(test, [testOpt]);
/*
Result:
{
"args": ["test", "1", "2", "3"],
"options": {"test", "OK"}
}
*/