From b7e019441489db8e3305e4f50b747e12fa4ae3d0 Mon Sep 17 00:00:00 2001 From: Thomas Weyn Date: Wed, 14 Mar 2018 22:04:20 +0100 Subject: [PATCH] Re-introduced setCommandLineArgs from vibe-d:core-0.8.2 (pull/1916) --- source/vibe/core/args.d | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) mode change 100644 => 100755 source/vibe/core/args.d diff --git a/source/vibe/core/args.d b/source/vibe/core/args.d old mode 100644 new mode 100755 index ae4a4c0..dca6f78 --- a/source/vibe/core/args.d +++ b/source/vibe/core/args.d @@ -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;