From 181bf16539d425d4f07501905cc9326b434ce75e Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 14 Nov 2022 17:56:13 +0100 Subject: editor: factor out argv parsing code --- editor/app.cpp | 7 ++++++- editor/app.hpp | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/editor/app.cpp b/editor/app.cpp index b031d6f3..85bbba54 100644 --- a/editor/app.cpp +++ b/editor/app.cpp @@ -73,7 +73,7 @@ static int atoi_(const char* str) return negative ? result : -result; } -int app::run_from_argv(const int argc, const char* const* const argv) +fm_settings app::parse_cmdline(int argc, const char* const* argv) { fm_settings opts; Corrade::Utility::Arguments args{}; @@ -98,7 +98,12 @@ int app::run_from_argv(const int argc, const char* const* const argv) else opts.msaa_samples = (std::uint8_t)n; } + return opts; +} +int app::run_from_argv(const int argc, const char* const* const argv) +{ + auto opts = parse_cmdline(argc, argv); int ret; Pointer ptr; { diff --git a/editor/app.hpp b/editor/app.hpp index 5b4497b0..57487b01 100644 --- a/editor/app.hpp +++ b/editor/app.hpp @@ -33,7 +33,8 @@ struct cursor_state final { struct app final : floormat_app { - static int run_from_argv(int argv, const char* const* argc); + static int run_from_argv(int argc, const char* const* argv); + static fm_settings parse_cmdline(int argc, const char* const* argv); ~app() override; private: -- cgit v1.2.3