From 6c70f89e8e8e312a4a738c180742c0ab41b3ab95 Mon Sep 17 00:00:00 2001 From: Arttu Tarkiainen Date: Thu, 18 Mar 2021 13:07:39 +0200 Subject: CLI: Add support for additional filtering of search results Search command results can now be optionally filtered with the '--filter-packages'-option, which takes an unspecified count of key-value pairs that contain the desired package information element and a regular expression used to find matches in the element. Example usage: 'installer --fp "Version=1.0, Description=Some text" search *' Only the packages which match all given filter rules are included in the output print. Task-number: QTIFW-2168 Change-Id: I788b065d95952b988489c36db80b3c859b970f05 Reviewed-by: Katja Marttila --- src/libs/installer/commandlineparser.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/libs/installer/commandlineparser.cpp') diff --git a/src/libs/installer/commandlineparser.cpp b/src/libs/installer/commandlineparser.cpp index 59d42eefc..4bfc4ad3a 100644 --- a/src/libs/installer/commandlineparser.cpp +++ b/src/libs/installer/commandlineparser.cpp @@ -59,6 +59,9 @@ CommandLineParser::CommandLineParser() .arg(CommandLineOptions::scListShort, CommandLineOptions::scListLong) + indent + QString::fromLatin1("%1, %2 - search available packages - \n") .arg(CommandLineOptions::scSearchShort, CommandLineOptions::scSearchLong) + + indent + indent + QString::fromLatin1("Note: The --%1 option can be used to specify\n") + .arg(CommandLineOptions::scFilterPackagesLong) + + indent + indent + QLatin1String("additional filters for the search operation\n") + indent + QString::fromLatin1("%1, %2 - create offline installer from selected packages - \n") .arg(CommandLineOptions::scCreateOfflineShort, CommandLineOptions::scCreateOfflineLong) + indent + QString::fromLatin1("%1, %2 - uninstall all packages and remove entire program directory") @@ -161,6 +164,12 @@ CommandLineParser::CommandLineParser() << CommandLineOptions::scCreateLocalRepositoryShort << CommandLineOptions::scCreateLocalRepositoryLong, QLatin1String("Create a local repository inside the installation directory. This option " "has no effect on online installers."))); + addOptionWithContext(QCommandLineOption(QStringList() + << CommandLineOptions::scFilterPackagesShort << CommandLineOptions::scFilterPackagesLong, + QLatin1String("[CLI] Comma separated list of additional key-value pair filters used to query packages with the " + "search command. The keys can be any of the possible package information elements, like " + "\"DisplayName\" and \"Description\"."), + QLatin1String("element=regex,...")), CommandLineOnly); // Message query options addOptionWithContext(QCommandLineOption(QStringList() << CommandLineOptions::scAcceptMessageQueryShort -- cgit v1.2.3