gerrit: add a help-all subcommand

This makes it easy to scan all subcommands at once.

BUG=None
TEST=`gerrit help-all` shows it all

Change-Id: I611033cb02cf34b5a3cce342ce354cb8da5fe710
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/2342385
Tested-by: Mike Frysinger <vapier@chromium.org>
Auto-Submit: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Alex Klein <saklein@chromium.org>
Commit-Queue: Alex Klein <saklein@chromium.org>
diff --git a/scripts/gerrit.py b/scripts/gerrit.py
index 1fcf89f..9bf7907 100644
--- a/scripts/gerrit.py
+++ b/scripts/gerrit.py
@@ -796,6 +796,27 @@
             (acct['_account_id'], acct['name'], acct['email']))
 
 
+class ActionHelpAll(UserAction):
+  """Show all actions help output at once."""
+
+  COMMAND = 'help-all'
+
+  @staticmethod
+  def __call__(opts):
+    """Implement the action."""
+    first = True
+    for action in _GetActions():
+      if first:
+        first = False
+      else:
+        print('\n\n')
+
+      try:
+        opts.parser.parse_args([action, '--help'])
+      except SystemExit:
+        pass
+
+
 @memoize.Memoize
 def _GetActions():
   """Get all the possible actions we support.
@@ -914,6 +935,9 @@
   parser = GetParser()
   opts = parser.parse_args(argv)
 
+  # In case the action wants to throw a parser error.
+  opts.parser = parser
+
   # A cache of gerrit helpers we'll load on demand.
   opts.gerrit = {}