Blame SOURCES/0008-Improve-help-for-dnf-module-command-RhBug1758447.patch

878112
From 27d2957e5051cc2edbea3a0d28a630e7eabfd673 Mon Sep 17 00:00:00 2001
878112
From: Marek Blaha <mblaha@redhat.com>
878112
Date: Fri, 6 Dec 2019 09:19:11 +0100
878112
Subject: [PATCH] Improve help for 'dnf module' command (RhBug:1758447)
878112
878112
Added short summary for each subcommand of the 'dnf module' command.
878112
878112
https://bugzilla.redhat.com/show_bug.cgi?id=1758447
878112
---
878112
 dnf/cli/commands/module.py | 22 ++++++++++++++++++----
878112
 1 file changed, 18 insertions(+), 4 deletions(-)
878112
878112
diff --git a/dnf/cli/commands/module.py b/dnf/cli/commands/module.py
878112
index 07883af6a3..5a6c0069fb 100644
878112
--- a/dnf/cli/commands/module.py
878112
+++ b/dnf/cli/commands/module.py
878112
@@ -74,6 +74,7 @@ def _get_module_artifact_names(self, use_modules, skip_modules):
878112
     class ListSubCommand(SubCommand):
878112
 
878112
         aliases = ('list',)
878112
+        summary = _('list all module streams, profiles and states')
878112
 
878112
         def configure(self):
878112
             demands = self.cli.demands
878112
@@ -107,6 +108,7 @@ def run_on_module(self):
878112
     class InfoSubCommand(SubCommand):
878112
 
878112
         aliases = ('info',)
878112
+        summary = _('print detailed information about a module')
878112
 
878112
         def configure(self):
878112
             demands = self.cli.demands
878112
@@ -128,6 +130,7 @@ def run_on_module(self):
878112
     class EnableSubCommand(SubCommand):
878112
 
878112
         aliases = ('enable',)
878112
+        summary = _('enable a module stream')
878112
 
878112
         def configure(self):
878112
             demands = self.cli.demands
878112
@@ -151,6 +154,7 @@ def run_on_module(self):
878112
     class DisableSubCommand(SubCommand):
878112
 
878112
         aliases = ('disable',)
878112
+        summary = _('disable a module with all its streams')
878112
 
878112
         def configure(self):
878112
             demands = self.cli.demands
878112
@@ -174,6 +178,7 @@ def run_on_module(self):
878112
     class ResetSubCommand(SubCommand):
878112
 
878112
         aliases = ('reset',)
878112
+        summary = _('reset a module')
878112
 
878112
         def configure(self):
878112
             demands = self.cli.demands
878112
@@ -194,6 +199,7 @@ def run_on_module(self):
878112
     class InstallSubCommand(SubCommand):
878112
 
878112
         aliases = ('install',)
878112
+        summary = _('install a module profile including its packages')
878112
 
878112
         def configure(self):
878112
             demands = self.cli.demands
878112
@@ -214,6 +220,7 @@ def run_on_module(self):
878112
     class UpdateSubCommand(SubCommand):
878112
 
878112
         aliases = ('update',)
878112
+        summary = _('update packages associated with an active stream')
878112
 
878112
         def configure(self):
878112
             demands = self.cli.demands
878112
@@ -230,6 +237,7 @@ def run_on_module(self):
878112
     class RemoveSubCommand(SubCommand):
878112
 
878112
         aliases = ('remove', 'erase',)
878112
+        summary = _('remove installed module profiles and their packages')
878112
 
878112
         def configure(self):
878112
             demands = self.cli.demands
878112
@@ -266,6 +274,7 @@ def run_on_module(self):
878112
     class ProvidesSubCommand(SubCommand):
878112
 
878112
         aliases = ("provides", )
878112
+        summary = _('list modular packages')
878112
 
878112
         def configure(self):
878112
             demands = self.cli.demands
878112
@@ -280,6 +289,7 @@ def run_on_module(self):
878112
     class RepoquerySubCommand(SubCommand):
878112
 
878112
         aliases = ("repoquery", )
878112
+        summary = _('list packages belonging to a module')
878112
 
878112
         def configure(self):
878112
             demands = self.cli.demands
878112
@@ -342,10 +352,14 @@ def set_argparser(self, parser):
878112
         narrows.add_argument('--all', dest='all',
878112
                              action='store_true',
878112
                              help=_("remove all modular packages"))
878112
-
878112
-        subcommand_help = [subcmd.aliases[0] for subcmd in self.SUBCMDS]
878112
-        parser.add_argument('subcmd', nargs=1, choices=subcommand_help,
878112
-                            help=_("Modular command"))
878112
+        subcommand_choices = []
878112
+        subcommand_help = []
878112
+        for subcmd in sorted(self.SUBCMDS, key=lambda x: x.aliases[0]):
878112
+            subcommand_choices.append(subcmd.aliases[0])
878112
+            subcommand_help.append('{}: {}'.format(subcmd.aliases[0], subcmd.summary or ''))
878112
+        parser.add_argument('subcmd', nargs=1, choices=subcommand_choices,
878112
+                            metavar='<modular command>',
878112
+                            help='\n'.join(subcommand_help))
878112
         parser.add_argument('module_spec', metavar='module-spec', nargs='*',
878112
                             help=_("Module specification"))
878112