]> git.ipfire.org Git - thirdparty/samba.git/commit
samba-tool: all subcommands know --version
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Wed, 15 Jan 2025 02:33:18 +0000 (15:33 +1300)
committerDouglas Bagnall <dbagnall@samba.org>
Sat, 8 Feb 2025 02:33:38 +0000 (02:33 +0000)
commit8aec198306ed005a815220e6ca3dfed6774290b2
tree1a325ed9f3006ff4c2925e6ff5514626a4d1c05b
parent3a408f06aeaceb22ea23f6f6e8118fb8e0490591
samba-tool: all subcommands know --version

Before `samba-tool -V` would give you the version,
but `samba-tool spn -V` would complain.

An ad-hoc selection of sub-commands already supported --version,
depending on whether VersionOptions was manually added to the
takes_options dict. The .run() methods of these subcommands all take a
'versionopts' keyword argument, but never use it. If it was set (i.e.,
argv contained "--version"), the process never gets to .run(), so the
value of versionopts.version is always None in run(). After this
commit we can remove VersionOptions/versionopts from sub-commands.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15770

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
python/samba/netcmd/__init__.py
python/samba/netcmd/main.py
selftest/knownfail.d/samba-tool--version