samba-tool: fetch "no such subcommand" error and print error message
authorBjörn Baumbach <bb@sernet.de>
Tue, 28 Apr 2020 15:09:56 +0000 (17:09 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 29 Apr 2020 08:08:21 +0000 (08:08 +0000)
commitdc280f88becc6679cd95bf8914f80812358338cc
tree21b3c3bc933fbbcf26bab50a6d53cdecec1fc1ca
parentae5cb7346bf6f7759c88d7df6a5c1bd7965ee284
samba-tool: fetch "no such subcommand" error and print error message

This patch especially improves the case where extra arguments are used.

Without this patch just the attributes are mentioned as invalid, if
samba-tool is called with an invalid/unknown subcommand.

Example without this patch:
  # samba-tool sites list --all
  Usage: samba-tool sites <subcommand>

  samba-tool sites: error: no such option: --all

This can be deceptive for users. Is looks like the "list" command
does not provide a "--all" option.

Example with this patch:
  # samba-tool sites list --all
  samba-tool sites: no such subcommand: list

  Usage: samba-tool sites <subcommand>
  (...)

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Apr 29 08:08:21 UTC 2020 on sn-devel-184
python/samba/netcmd/__init__.py