darg 0.0.1

D command line argument parser.


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

Build Status

D Argument Parser

Better command line argument parsing using D's powerful compile-time code generation facilities.

Example

import std.stdio;
import darg;

struct Options
{
    @Option("help", "h")
    OptionFlag help;

    @Option("threads", "t")
    size_t threads;

    @Argument("file", Multiplicity.zeroOrMore)
    @Help("Input files")
    string[] files;
}

int main(string[] args)
{
    Options options;

    try
    {
        options = parseArgs!Options(args[1 .. $]);
    }
    catch (ArgParseException e)
    {
        writeln(usageString!Options);
        return 1;
    }

    if (options.help == OptionFlag.yes)
    {
        writeln(helpString!Options);
        return 0;
    }

    foreach (f; options.files)
    {
        // Use files
    }
}

License

MIT License

Authors:
  • Jason White
Dependencies:
none
Versions:
0.1.0 2018-Aug-11
0.0.5 2018-Jul-31
0.0.4 2016-Apr-05
0.0.3 2016-Feb-19
0.0.2 2016-Feb-19
Show all 7 versions
Download Stats:
  • 0 downloads today

  • 3 downloads this week

  • 5 downloads this month

  • 2702 downloads total

Score:
2.0
Short URL:
darg.dub.pm