structopt ~actionsetup
Generate GetOpt method call from Structure
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:
This package comes from a little tool I wrote for myself, then blogged about here.
https://dev.to/jessekphillips/argument-parsing-into-structure-4p4n
It allows for using a structure to define the desired command line arguments. Inspired by darg.
import structopt;
// Specify The Parameter Structure
struct Options
{
@Option("threads", "t")
@Help("Number of threads to use.")
size_t threads;
@Option("file")
@Help("Input files")
string[] files;
}
void main(string[] args) {
Options props;
// Pass in the struct to generate UDA for
auto helpInfo = mixin(GenerateGetopt!props);
defaultGetoptPrinter("Options: ",
helpInfo.options);
// Output to console:
//Options:
//-t --threads Number of threads to use.
// --file Input files
//-h --help This help information./
}
- ~actionsetup released 4 years ago
- JesseKPhillips/structopt
- Boost
- Copyright © 2019, Jesse Phillips
- Authors:
- Dependencies:
- none
- Versions:
-
0.0.4 2020-Jan-27 0.0.3 2019-Oct-27 0.0.2 2019-Oct-23 0.0.1 2019-Oct-23 ~master 2020-Jan-27 - Download Stats:
-
-
0 downloads today
-
0 downloads this week
-
0 downloads this month
-
20 downloads total
-
- Score:
- 1.0
- Short URL:
- structopt.dub.pm