-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add --config-json-path to accept flags specified in a JSON file. (#265)
Add flag --config-json-path to accept commandline flags that are specified in a JSON file. This flag can be used multiple times. The priority of any conflicting flags is as follows: later flag on commandline > earlier flag on commandline > flag in later JSON file > flag in earlier JSON file For flags that accept multiple values, the same priority is used and only flags specified in the same JSON file or flags all on the commandline will be combined. Detailed changes: * Changed map `mAllOptions` to hold `strings` instead of `string_views` since there are now temporary strings originating from the JSON structure, changed some input parameters for `CliOptions` member functions to match. * Created some `CommandLineParser` methods to aid in parsing options (these are public for unit testing purposes) * `ParseJson` * `ParseOption` * Created more methods for `CliOptions` * `AddOption` overload that accepts one key and a vector of values to reduce the time needed to insert arrays. This function is only used by the JSON parsing flow. On the command line the flag must still be specified multiple times (`--flag-name 1,2,3` is still invalid) * `OverwriteOptions` * Updated `CommandLineParser::Parse` * Added a second initial pass of argv during commandline parsing to identify any provided JSON config files * Implemented overwriting * Added `mJsonConfigFlagName` to `CommandLineParser` so that the string `config-json-path` isn't specified in multiple places
- Loading branch information
1 parent
e34b91e
commit 4bdd70e
Showing
5 changed files
with
346 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.