diff mercurial/registrar.py @ 40291:170926caf44c

help: adding support for command categories Differential Revision: https://phab.mercurial-scm.org/D5065
author rdamazio@google.com
date Sat, 13 Oct 2018 05:03:50 -0700
parents 5d3b58472660
children c303d65d2e34
line wrap: on
line diff
--- a/mercurial/registrar.py	Sun Oct 14 13:35:47 2018 +0200
+++ b/mercurial/registrar.py	Sat Oct 13 05:03:50 2018 -0700
@@ -146,6 +146,10 @@
     to prevent the command from running if the requested intent could not be
     fulfilled.
 
+    If `helpcategory` is set (usually to one of the constants in the help
+    module), the command will be displayed under that category in the help's
+    list of commands.
+
     The following intents are defined:
 
     readonly
@@ -164,14 +168,17 @@
     descriptions and examples.
     """
 
+    # Command categories for grouping them in help output.
+    CATEGORY_NONE = 'none'
+
     def _doregister(self, func, name, options=(), synopsis=None,
                     norepo=False, optionalrepo=False, inferrepo=False,
-                    intents=None):
-
+                    intents=None, helpcategory=None):
         func.norepo = norepo
         func.optionalrepo = optionalrepo
         func.inferrepo = inferrepo
         func.intents = intents or set()
+        func.helpcategory = helpcategory
         if synopsis:
             self._table[name] = func, list(options), synopsis
         else: