A cover for D standard library 'getopt' routine (std.getopt.getopt) function that preserves command line argument processing order.

This is a work-around to a limitation in getopt, in that getopt does not process arguments in command line order. Instead, getopt processes options in the order specified in the call to getopt. That is, the order in the text of the code. This prevents using command line options in ways where order specified by the user is taken into account.

More details here: https://issues.dlang.org/show_bug.cgi?id=16539

This should only be used when retaining order is important. Though minimized, there are cases that don't work as expected, the most important involving option arguments starting with a dash. See the getoptInorder function comments for specifics.

Copyright (c) 2016-2021, eBay Inc. Initially written by Jon Degenhardt



GetoptResult getoptInorder(string[] args, T opts)

getoptInorder is a cover to std.getopt that processes command line options in the order on the command.



Boost License 1.0 (http://boost.org/LICENSE_1_0.txt)


- Unit tests in this file have been adopted from unit tests for the D programming language std.getopt standard library modules (https://dlang.org/phobos/std_getopt.html).

Boost License 1.0 (http://boost.org/LICENSE_1_0.txt)