samba-tool: removed synopsis code in base class
authorGiampaolo Lauria <lauria2@yahoo.com>
Mon, 18 Jul 2011 21:46:02 +0000 (17:46 -0400)
committerAndrew Tridgell <tridge@samba.org>
Thu, 21 Jul 2011 01:44:31 +0000 (11:44 +1000)
As it is not always possible to determine the usage of a command solely based on the list of required and optional args, it is best
to have the subclasses always define it, rather than displaying an incorrect usage statement. Currently, all commands are subclassing the synopsis.

Signed-off-by: Andrew Tridgell <tridge@samba.org>
source4/scripting/python/samba/netcmd/__init__.py

index e7ec1f78369c3f8247fd8654af88b418ee28d04d..2de679d6f7249a3a4a5df409c88214eef471cb83 100644 (file)
@@ -50,12 +50,6 @@ class Command(object):
 
     description = property(_get_description)
 
-    def _get_synopsis(self):
-        ret = self.name
-        if self.takes_args:
-            ret += " " + " ".join([x.upper() for x in self.takes_args])
-        return ret
-
     def show_command_error(self, e):
         '''display a command error'''
         if isinstance(e, CommandError):
@@ -89,10 +83,10 @@ class Command(object):
         if force_traceback or samba.get_debug_level() >= 3:
             traceback.print_tb(etraceback)
 
-    synopsis = property(_get_synopsis)
-
     outf = sys.stdout
 
+    # synopsis must be defined in all subclasses in order to provide the command usage
+    synopsis = ""
     takes_args = []
     takes_options = []
     takes_optiongroups = {