lazyargs
TypeScript icon, indicating that this package has built-in type declarations

3.0.0 • Public • Published

LazyArgs

A typescript command line argument parser that does the work for you

class YourNestedOptions {
	arg: string = "Hello nested";
}

class YourCLIOptions {
	foo: number = 10;

	OptionDoc("Some good documentation")
	bar: string = Hello World;

	OptionShort('n')
	nested: YourNestedOptions = new YourNestedOptions();
}

let options = new YourCLIOptions();
return parseCMD(options, "Header for the help string");

// options are passed in as --foo 1234 or --bar "A string"'
// for nested options your prefix the passed args as --nested.arg "Foo"

If -h or --help is passed the help information will be printed and process.exit(0) is called.

This package requires:

{
	"compilerOptions": {
		"experimentalDecorators": true
	}
}

to be passed to the typescript compiler.

Package Sidebar

Install

npm i lazyargs

Weekly Downloads

24

Version

3.0.0

License

MIT

Unpacked Size

69.7 kB

Total Files

9

Last publish

Collaborators

  • burner_rs