From: Douglas Bagnall Date: Thu, 29 Feb 2024 03:29:30 +0000 (+1300) Subject: samba-tool: don't error if there are no sub-commands X-Git-Tag: tdb-1.4.11~1626 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=884d40ca16549d5a69119a2a2470ae4e45ee816a;p=thirdparty%2Fsamba.git samba-tool: don't error if there are no sub-commands 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 Reviewed-by: Andrew Bartlett --- diff --git a/python/samba/netcmd/__init__.py b/python/samba/netcmd/__init__.py index 01497055d68..e83c8390c55 100644 --- a/python/samba/netcmd/__init__.py +++ b/python/samba/netcmd/__init__.py @@ -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: