/[gnue]/gnue-dbtools/src/sql/commands/help.py
ViewVC logotype

Diff of /gnue-dbtools/src/sql/commands/help.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by jcater, Fri Sep 26 04:28:40 2003 UTC revision 1.3 by jcater, Fri Sep 26 18:07:24 2003 UTC
# Line 32  from Base import BaseCommand Line 32  from Base import BaseCommand
32  import string  import string
33    
34  class Command(BaseCommand):  class Command(BaseCommand):
35    SHORT = "Shows the help screen"    SHORT = _("Shows the help screen")
36    def call(self, args=()):    def call(self, args=()):
37      try:      try:
38        command = args[0].lower()        command = args[0].lower()
39      except:      except:
40        command = 'help'        command = 'intro'
41    
42      if command == 'commands':      if command == 'commands':
43        lt = self.instance.commands.keys()        lt = self.instance.commands.keys()
44        lt.sort()        lt.sort()
45        mx = 0        mx = 0
46        for l in lt:        for l in lt:
47          mx = max(mx, len(lt))          mx = max(mx, len(l))
48    
49        print        print
50        print "Available commands:"        print _("Available commands:")
51        for l in lt:        for l in lt:
52          print "  " + string.ljust(l + ': ', mx + 3), self.instance.commands[l].SHORT          print "  " + string.ljust(l + ': ', mx + 3), self.instance.commands[l].SHORT
53        print        print
54    
55      else:      elif command in self.instance.commands.keys():
56          print
57          print _("Help for %s command:") % command
58        print        print
59        print "Sorry, no help currently available :("        print "  " + self.instance.commands[command].help(args[1:]).replace('\n','\n  ')
60        print        print
61    
62        elif command == 'intro':
63          print
64          print _("""\
65    GNUe SQL Shell Help
66    ===================
67    
68    GNUe-SQL is an interactive shell for running SQL statements against your
69    favorite database.
70    
71    It also supports basic reporting features and data dumping.
72    
73    * For a list of available commands, run HELP COMMANDS
74    * For help with runtime settings, run HELP SET
75    * For help with command-line parameters, run HELP SWITCHES
76    * For help with formatting fields, run HELP FORMAT
77    * For help with outputting
78    
79    To Exit GNUe SQL Shell, enter QUIT and press RETURN.
80    """)
81        else:
82          print _("""
83    Help is currently unavailable for this topic.  Bug the developers.
84    (Or volunteer to write this module :)
85          """)

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26