Add command line argument parser with ini ConsoleVariables fallback - #179
Merged
Conversation
…back Adds -key=value / --key=value / bare -flag parsing (issue #154), a shared StringUtils::ParseAs<T> for bool/int/float/double/string conversion, and an ini "[ConsoleVariables]" section fallback so config files can supply defaults that command line args still override. Wires CommandLine::Get().LoadConfigFile into Engine::Startup alongside FlingConfig, and removes FlingConfig's old unused LoadCommandLineOpts stub now that CommandLine owns this responsibility. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
MSVC defaults to C++14 when no /std flag is passed, so the standalone Catch2 build step in the CI workflow compiled it without std::string_view support. FlingTests (built at C++20 like the rest of the project) then failed to link with an unresolved Catch::StringMaker<std::string_view>::convert symbol. Linux passed only because GCC 11+/Clang already default to C++17+. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 task
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fling::CommandLineargument parser supporting-key=value,--key=value, and bare-flag/--flag(implicittrue) syntax, with quoted-string values (-title="Fling Engine") and a 256-char max per argument.Fling::StringUtils::ParseAs<T>, a single shared string→type converter (bool/int/float/double/string) reused byCommandLine::GetValueAs<T>so every system parses "true"/"7"/"3.14" the same way.[ConsoleVariables]support (CommandLine::LoadConfigFile/LoadConfigVarsFromString), UE-style: values from the ini act as a fallback, and command line values always win when a key is set in both places. Wired intoEngine::Startupalongside the existingFlingConfigini load.FlingConfig::LoadCommandLineOpts, an unused stub now superseded byCommandLine.Test plan
FlingTests(CommandLineTests.cpp,StringUtilsTests.cpp) — 91 assertions across 12 test cases, all passing, including edge cases for double-dash flags, malformed single-token args, max arg length, and command-line-vs-ini precedence.Sandboxbuilds and links against the updatedEngine/CommandLineAPI.maininto this branch (submodule bumps,NOMINMAXfix, comment cleanups) with no conflicts; full rebuild + test suite re-verified afterward.🤖 Generated with Claude Code