diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2022-11-14 17:56:13 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-11-14 17:56:13 +0100 |
commit | 181bf16539d425d4f07501905cc9326b434ce75e (patch) | |
tree | 00491e12245d3829a12b852c3bddbd140843ae0d | |
parent | 10a0022f35e6bfccbbbf6fbd1538b9164cd569ff (diff) |
editor: factor out argv parsing code
-rw-r--r-- | editor/app.cpp | 7 | ||||
-rw-r--r-- | 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<floormat_main> 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: |