]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
samba-tool: don't error if there are no sub-commands
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Thu, 29 Feb 2024 03:29:30 +0000 (16:29 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 1 Mar 2024 00:19:45 +0000 (00:19 +0000)
This is useful when you commit samba-tool tests before you commit the
samba-tool code, and you want the tests to fail rather than error.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/netcmd/__init__.py

index 01497055d68588f84893674faf594ae0c327b399..e83c8390c55fa8af02fd9059f78fc0b2fe7adc02 100644 (file)
@@ -428,7 +428,7 @@ class SuperCommand(Command):
         epilog = "\nAvailable subcommands:\n"
 
         subcmds = sorted(self.subcommands.keys())
-        max_length = max([len(c) for c in subcmds])
+        max_length = max([len(c) for c in subcmds], default=0)
         for cmd_name in subcmds:
             cmd = self.subcommands[cmd_name]
             if cmd.hidden: