From e4ae41e3a29fc3e4714e1c3f8c9f071768d17b68 Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Sun, 10 Jan 2021 22:28:38 -0500 Subject: fixed all commands being legacy split running command into pre and post organizer --- src/commandline.h | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'src/commandline.h') diff --git a/src/commandline.h b/src/commandline.h index 09c1bb8e..14a453b2 100644 --- a/src/commandline.h +++ b/src/commandline.h @@ -50,13 +50,18 @@ public: // virtual bool legacy() const; - // runs this command, eventually calls doRun() // - std::optional run( + // + void process( const std::wstring& originalLine, po::variables_map vm, std::vector untouched); + // + // + virtual std::optional runPreOrganizer(); + virtual std::optional runPostOrganizer(); + protected: // meta information about this command, returned by derived classes // @@ -86,10 +91,6 @@ protected: // virtual Meta meta() const = 0; - // runs the command - // - virtual std::optional doRun() = 0; - // returns the original command line // @@ -117,7 +118,7 @@ class CrashDumpCommand : public Command protected: po::options_description getVisibleOptions() const override; Meta meta() const override; - std::optional doRun() override; + std::optional runPreOrganizer() override; }; @@ -140,7 +141,7 @@ public: protected: Meta meta() const override; - std::optional doRun() override; + std::optional runPreOrganizer() override; int SpawnWaitProcess(LPCWSTR workingDirectory, LPCWSTR commandLine); @@ -159,7 +160,7 @@ protected: po::options_description getInternalOptions() const override; po::positional_options_description getPositional() const override; Meta meta() const override; - std::optional doRun() override; + std::optional runPostOrganizer() override; }; @@ -170,7 +171,7 @@ class RunCommand : public Command protected: po::options_description getOptions() const; Meta meta() const override; - std::optional doRun() override; + std::optional runPostOrganizer() override; }; @@ -218,14 +219,14 @@ public: // returns an empty optional if execution should continue, or a return code // if MO must quit // - std::optional run(const std::wstring& line); + std::optional process(const std::wstring& line); // handles moshortcut, nxm links and starting processes // // returns an empty optional if execution should continue, or a return code // if MO must quit // - std::optional setupCore(OrganizerCore& organizer) const; + std::optional run(OrganizerCore& organizer) const; // clears parsed options, used when MO is "restarted" so the options aren't @@ -275,6 +276,7 @@ private: std::optional m_nxmLink; std::optional m_executable; QStringList m_untouched; + Command* m_command; void createOptions(); std::string more() const; -- cgit v1.3.1