pgsql/create_tables.pgsql: Eliminated two unnecessary differences.
authorPascal Volk <user@localhost.localdomain.org>
Mon, 27 Aug 2012 22:24:11 +0000
changeset 596 607aa5c2acc4
parent 595 86b967c0f1a1
child 597 c79fdce49908
pgsql/create_tables.pgsql: Eliminated two unnecessary differences. Yeah, cosmetic only.
VirtualMailManager/cli/subcommands.py
pgsql/create_tables.pgsql
--- a/VirtualMailManager/cli/subcommands.py	Mon Aug 27 22:09:24 2012 +0000
+++ b/VirtualMailManager/cli/subcommands.py	Mon Aug 27 22:24:11 2012 +0000
@@ -16,6 +16,7 @@
 
 from VirtualMailManager import ENCODING
 from VirtualMailManager.cli import get_winsize, prog, w_err, w_std
+from VirtualMailManager.cli.clihelp import help_msgs
 from VirtualMailManager.common import human_size, size_in_bytes, \
      version_str, format_domain_default
 from VirtualMailManager.constants import __copyright__, __date__, \
@@ -48,6 +49,10 @@
 class Command(object):
     """Container class for command information."""
     __slots__ = ('name', 'alias', 'func', 'args', 'descr')
+    FMT_HLP_USAGE = """
+usage: %(prog)s %(name)s %(args)s
+       %(prog)s %(alias)s %(args)s
+"""
 
     def __init__(self, name, alias, func, args, descr):
         """Create a new Command instance.
@@ -76,6 +81,25 @@
         """the command's usage info."""
         return u'%s %s %s' % (prog, self.name, self.args)
 
+    def help_(self):
+        old_ii = txt_wrpr.initial_indent
+        old_si = txt_wrpr.subsequent_indent
+
+        txt_wrpr.subsequent_indent = (len(self.name) + 2) * ' '
+        w_std(txt_wrpr.fill('%s: %s' % (self.name, self.descr)))
+
+        info = Command.FMT_HLP_USAGE % dict(alias=self.alias, args=self.args,
+                                            name=self.name, prog=prog)
+        w_std(info)
+
+        txt_wrpr.initial_indent = txt_wrpr.subsequent_indent = ' '
+        try:
+            [w_std(txt_wrpr.fill(_(para)) + '\n') for para
+                    in help_msgs[self.name]]
+        except KeyError:
+            w_err(1, "'help %s' not yet documented." % self.name,
+                  'see also: vmm(1)')
+
 
 class RunContext(object):
     """Contains all information necessary to run a subcommand."""
@@ -443,8 +467,8 @@
             else:
                 usage(INVALID_ARGUMENT, _(u"Unknown help topic: '%s'") %
                       ctx.args[2], ctx.scmd)
-        # FIXME
-        w_err(1, "'help %s' not yet implemented." % topic, 'see also: vmm(1)')
+        if topic != u'help':
+            return cmd_map[topic].help_()
 
     old_ii = txt_wrpr.initial_indent
     old_si = txt_wrpr.subsequent_indent
--- a/pgsql/create_tables.pgsql	Mon Aug 27 22:09:24 2012 +0000
+++ b/pgsql/create_tables.pgsql	Mon Aug 27 22:24:11 2012 +0000
@@ -6,9 +6,9 @@
 
 CREATE SEQUENCE mailboxformat_id;
 
-CREATE SEQUENCE quotalimit_id;
+CREATE SEQUENCE maillocation_id;
 
-CREATE SEQUENCE maillocation_id;
+CREATE SEQUENCE quotalimit_id;
 
 CREATE SEQUENCE service_set_id;
 
@@ -101,7 +101,7 @@
 CREATE TABLE domain_data (
     gid         bigint NOT NULL DEFAULT nextval('domain_gid'),
     qid         bigint NOT NULL DEFAULT 1, -- default quota limit
-    ssid        bigint NOT NULL DEFAULT 1, -- default service_set
+    ssid        bigint NOT NULL DEFAULT 1, -- default service set
     tid         bigint NOT NULL DEFAULT 1, -- default transport
     domaindir   varchar(40) NOT NULL, --/srv/mail/$RAND/4294967294
     note        text NULL DEFAULT NULL,