diff options
author | Katja Marttila <katja.marttila@qt.io> | 2019-10-22 13:33:11 +0300 |
---|---|---|
committer | Katja Marttila <katja.marttila@qt.io> | 2020-02-14 09:52:09 +0000 |
commit | ac38ce9ee96bc2b827d89b089a9d2e2ca37608d7 (patch) | |
tree | 9f3bc6e9902f7dbbf2a8d1314d00a58b09500136 /src/sdk/installerbase.cpp | |
parent | 817a2d41c9d506b7bb5fe3ba17e0a62cb8d59421 (diff) |
Uninstall selected packages from command line
Components can be uninstalled from CLI with
--uninstallPackages package1,package2,... Replicates the same behavior
as when removing from visual UI, so forced installation, virtual and
components installed as autodependency cannot be uninstalled.
Change-Id: Ibcd87b5ceb8e509c84c6944510c23e59b28dedb9
Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
Diffstat (limited to 'src/sdk/installerbase.cpp')
-rw-r--r-- | src/sdk/installerbase.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/sdk/installerbase.cpp b/src/sdk/installerbase.cpp index b63c911fa..a14999b45 100644 --- a/src/sdk/installerbase.cpp +++ b/src/sdk/installerbase.cpp @@ -377,6 +377,15 @@ int InstallerBase::run() if (!setTargetDirFromCommandLine(parser)) return EXIT_FAILURE; m_core->installDefaultComponentsSilently(); + } else if (parser.isSet(QLatin1String(CommandLineOptions::UninstallSelectedPackages))) { + if (m_core->isInstaller()) + throw QInstaller::Error(QLatin1String("Cannot start installer binary as package manager.")); + m_core->setPackageManager(); + QStringList packages; + const QString &value = parser.value(QLatin1String(CommandLineOptions::UninstallSelectedPackages)); + if (!value.isEmpty()) + packages = value.split(QLatin1Char(','), QString::SkipEmptyParts); + m_core->uninstallComponentsSilently(packages); } else { m_core->setCommandLineInstance(false); //create the wizard GUI |