/* Command-line argument parser. It works by using Odin's run-time type information to determine where and how to store data on a struct provided by the program. Type conversion is handled automatically and errors are reported with useful messages. Command-Line Syntax: Arguments are treated differently depending on how they're formatted. The format is similar to the Odin binary's way of handling compiler flags. type handling ------------ ------------------------ depends on struct layout - set a bool true - set flag to option - set flag to option, alternative syntax - set bit_set flag to one or more options - set bit_set flag to one or more options, alternative syntax -:= set map[key] to value Underscores (`_`) in a flag will be replaced with dashes (`-`). Bit sets may be set with a strictly comma-separated list of options. Bit sets may also be set with a binary string of 0s and 1s, and will be parsed from left to right, from least significant bit to most significant bit. Underscores are allowed and will be ignored. However, starting with an underscore is disallowed. Unhandled Arguments: All unhandled positional arguments are placed into the `overflow` field on a struct, if it exists. In UNIX-style parsing, the existence of a `--` on the command line will also pass all arguments afterwards into this field. If desired, the name of the field may be changed from `overflow` to any string by setting the `ODIN_CORE_FLAGS_OVERFLOW_FLAG` compile-time config option with `-define:ODIN_CORE_FLAGS_OVERFLOW_FLAG=`. Struct Tags: Users of the `core:encoding/json` package may be familiar with using tags to annotate struct metadata. The same technique is used here to annotate where arguments should go and which are required. Under the `args` tag, there are the following subtags: - `name=S`: set `S` as the flag's name. - `pos=N`: place positional argument `N` into this flag. - `hidden`: hide this flag from the usage documentation. - `required`: cause verification to fail if this argument is not set. - `manifold=N`: take several arguments at once, UNIX-style only. - `file`: for `os.Handle` types, file open mode. - `perms`: for `os.Handle` types, file open permissions. - `indistinct`: allow the setting of distinct types by their base type. `required` may be given a range specifier in the following formats: min