From f4ca82f798fa7e456bb904ed301ddc17db5410c8 Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Sat, 18 Jul 2020 05:30:57 -0400 Subject: fixed handling of profile names with different casing than on the filesystem added --instance --- src/commandline.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/commandline.cpp') diff --git a/src/commandline.cpp b/src/commandline.cpp index f5c4df60..11f43dea 100644 --- a/src/commandline.cpp +++ b/src/commandline.cpp @@ -120,6 +120,7 @@ void CommandLine::createOptions() m_visibleOptions.add_options() ("help", "show this message") ("multiple", "allow multiple instances of MO to run; see below") + ("instance,i", po::value(), "use the given instance (defaults to last used)") ("profile,p", po::value(), "use the given profile (defaults to last used)"); po::options_description options; @@ -187,6 +188,17 @@ std::optional CommandLine::profile() const return {}; } +std::optional CommandLine::instance() const +{ + if (m_shortcut.isValid() && m_shortcut.hasInstance()) { + return m_shortcut.instance(); + } else if (m_vm.count("instance")) { + return QString::fromStdString(m_vm["instance"].as()); + } + + return {}; +} + const MOShortcut& CommandLine::shortcut() const { return m_shortcut; -- cgit v1.3.1