Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

lazyargs

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

args, arguments, argv, cli parser, cli, cmd, command line argument parser, command line argument, command line arguments, option parser, options, parser, process.argv, typescript

readme

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.