Skip to content

Instantly share code, notes, and snippets.

@JakobOvrum
Created May 6, 2012 08:59
Show Gist options
  • Save JakobOvrum/2621155 to your computer and use it in GitHub Desktop.
Save JakobOvrum/2621155 to your computer and use it in GitHub Desktop.
// Example options
struct CmdOptions
{
/// Print information during execution.
bool verbose = false;
/// Output name.
string outputname = "foo";
}
void main(string[] args)
{
auto getOptArgs = GetOptArgs();
getOptArgs.programDescription = "This program does X and Y.";
getOptArgs.minimumArgs = 1;
auto options = getOpt!CmdOptions(getOptArgs, args);
/* use args[1], options.verbose, options.outputname etc. */
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment