Skip to content

Add command line argument parser with ini ConsoleVariables fallback - #179

Merged
BenjaFriend merged 6 commits into
mainfrom
command-line-update
Aug 8, 2026
Merged

Add command line argument parser with ini ConsoleVariables fallback#179
BenjaFriend merged 6 commits into
mainfrom
command-line-update

Conversation

@BenjaFriend

Copy link
Copy Markdown
Member

Summary

  • Closes Add a nice way to do command line arguments #154 — adds a real Fling::CommandLine argument parser supporting -key=value, --key=value, and bare -flag/--flag (implicit true) syntax, with quoted-string values (-title="Fling Engine") and a 256-char max per argument.
  • Adds Fling::StringUtils::ParseAs<T>, a single shared string→type converter (bool/int/float/double/string) reused by CommandLine::GetValueAs<T> so every system parses "true"/"7"/"3.14" the same way.
  • Adds ini [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 into Engine::Startup alongside the existing FlingConfig ini load.
  • Removes FlingConfig::LoadCommandLineOpts, an unused stub now superseded by CommandLine.

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.
  • Sandbox builds and links against the updated Engine/CommandLine API.
  • Merged latest main into this branch (submodule bumps, NOMINMAX fix, comment cleanups) with no conflicts; full rebuild + test suite re-verified afterward.

🤖 Generated with Claude Code

BenjaFriend and others added 6 commits May 25, 2024 21:07
…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>
@BenjaFriend
BenjaFriend merged commit fed394d into main Aug 8, 2026
4 of 6 checks passed
@BenjaFriend
BenjaFriend deleted the command-line-update branch August 8, 2026 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a nice way to do command line arguments

1 participant