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:
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
- Registered by Jason White
- 0.0.1 released 8 years ago
- jasonwhite/darg
- MIT
- Copyright © 2015-2016, Jason White
- Authors:
- 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 - Download Stats:
-
-
1 downloads today
-
3 downloads this week
-
10 downloads this month
-
2751 downloads total
-
- Score:
- 2.2
- Short URL:
- darg.dub.pm