Merge pull request #72 from Archipel/master

Re-introduced setCommandLineArgs from vibe-d:core-0.8.2 (pull/1916)
merged-on-behalf-of: Sönke Ludwig <s-ludwig@users.noreply.github.com>
This commit is contained in:
The Dlang Bot 2018-03-16 23:23:08 +01:00 committed by GitHub
commit f29f6564bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

25
source/vibe/core/args.d Normal file → Executable file
View file

@ -220,6 +220,31 @@ bool finalizeCommandLineOptions(string[]* args_out = null)
*/
enum isOptionValue(T) = is(T == bool) || is(T : long) || is(T : double) || is(T == string);
/**
This functions allows the usage of a custom command line argument parser
with vibe.d.
$(OL
$(LI build executable with version(VibeDisableCommandLineParsing))
$(LI parse main function arguments with a custom command line parser)
$(LI pass vibe.d arguments to `setCommandLineArgs`)
$(LI use vibe.d command line parsing utilities)
)
Params:
args = The arguments that should be handled by vibe.d
*/
void setCommandLineArgs(string[] args)
{
g_args = args;
}
///
unittest {
import std.format : format;
string[] args = ["--foo", "10"];
setCommandLineArgs(args);
}
private struct OptionInfo {
string[] names;