On Tuesday, 23 June 2015 at 14:52:30 UTC, Dmitry Olshansky wrote:
An example command:

@("<nanoseconds>") // arguments
@("Sets the amount of time to increment the clock on each frame.") //
description
@ShellOnly // can't be ran from command line
int cmd_set_time_per_frame(string[] args) {
     // ...
}

Awesome. Is it open-sourced?
How about handling argument conversion automatically (via to! and/or custom functions)?

Say :
@("<num1> <num2>")
@CmdName("plus")
void add(int a, int b)
{
        writelen(a+b);
}


To be automagically callable like:

./prog plus 2 4

Not yet; its ATM a bit coupled with the application I'm writing.

Specifying types with the arguments is definitely feasible, but I haven't gotten around to writing it yet. You could also possibly specify flag arguments (--foo) by specifying default parameters.

(somewhat related: std.getopts is kinda bad; you can't get help text without successfully parsing arguments and `required` breaks `--help`)

Reply via email to