Skip to content

Latest commit

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

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 StructurestructOptions
{
@Option("threads", "t")
@Help("Number of threads to use.")
size_t threads;
@Option("file")
@Help("Input files")
string[] files;
}
voidmain(string[] args) {
Options props;
// Pass in the struct to generate UDA forauto 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./
}

About

Generate GetOpt method call from Structure

Resources

Stars

8 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages