commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnue-dbtools/src/sql/commands __init__.py edit....


From: Jason Cater
Subject: gnue-dbtools/src/sql/commands __init__.py edit....
Date: Fri, 26 Sep 2003 14:07:24 -0400

CVSROOT:        /cvsroot/gnue
Module name:    gnue-dbtools
Branch:         
Changes by:     Jason Cater <address@hidden>    03/09/26 14:07:24

Modified files:
        src/sql/commands: __init__.py edit.py get.py help.py list.py 
                          save.py 
Added files:
        src/sql/commands: set.py show.py 
Removed files:
        src/sql/commands: option.py 

Log message:
        better help

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-dbtools/src/sql/commands/set.py?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-dbtools/src/sql/commands/show.py?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-dbtools/src/sql/commands/__init__.py.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-dbtools/src/sql/commands/edit.py.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-dbtools/src/sql/commands/get.py.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-dbtools/src/sql/commands/help.py.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-dbtools/src/sql/commands/list.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-dbtools/src/sql/commands/save.py.diff?tr1=1.2&tr2=1.3&r1=text&r2=text

Patches:
Index: gnue-dbtools/src/sql/commands/__init__.py
diff -c gnue-dbtools/src/sql/commands/__init__.py:1.2 
gnue-dbtools/src/sql/commands/__init__.py:1.3
*** gnue-dbtools/src/sql/commands/__init__.py:1.2       Fri Sep 26 00:28:40 2003
--- gnue-dbtools/src/sql/commands/__init__.py   Fri Sep 26 14:07:24 2003
***************
*** 42,53 ****
   'heading',
   'help',
   'input',
!  'list', 
!  'option',
   'print',
   'quit',
   'rollback',
   'save',
   'spool',
  )
  
--- 42,54 ----
   'heading',
   'help',
   'input',
!  'list',
   'print',
   'quit',
   'rollback',
   'save',
+  'set',
+  'show',
   'spool',
  )
  
***************
*** 55,59 ****
  def initCommands(instance):
    commands = {}
    for comm in all:
!     commands[comm] = _import("gnue.dbtools.sql.commands.%s" % 
comm).Command(instance)
    return commands
--- 56,60 ----
  def initCommands(instance):
    commands = {}
    for comm in all:
!     commands[_(comm)] = _import("gnue.dbtools.sql.commands.%s" % 
comm).Command(instance)   
    return commands
Index: gnue-dbtools/src/sql/commands/edit.py
diff -c gnue-dbtools/src/sql/commands/edit.py:1.2 
gnue-dbtools/src/sql/commands/edit.py:1.3
*** gnue-dbtools/src/sql/commands/edit.py:1.2   Fri Sep 26 00:28:40 2003
--- gnue-dbtools/src/sql/commands/edit.py       Fri Sep 26 14:07:24 2003
***************
*** 32,38 ****
  import tempfile, os, sys, string
  
  class Command(BaseCommand):
!   SHORT = "Opens the current buffer in an external editor"
    def call(self, args):
      file = tempfile.mktemp()
  
--- 32,38 ----
  import tempfile, os, sys, string
  
  class Command(BaseCommand):
!   SHORT = _("Opens the current buffer in an external editor")
    def call(self, args):
      file = tempfile.mktemp()
  
Index: gnue-dbtools/src/sql/commands/get.py
diff -c gnue-dbtools/src/sql/commands/get.py:1.2 
gnue-dbtools/src/sql/commands/get.py:1.3
*** gnue-dbtools/src/sql/commands/get.py:1.2    Fri Sep 26 00:28:40 2003
--- gnue-dbtools/src/sql/commands/get.py        Fri Sep 26 14:07:24 2003
***************
*** 31,42 ****
  import os
  
  class Command(BaseCommand):
!   SHORT = "Loads a file into the current buffer"
    def call(self, args):
      try:
        file = args[0]
      except:
!       raise CommandError,'GET requires a file name as its first argument'
  
      if not os.path.isfile(file):
        file = file + '.sql'
--- 31,42 ----
  import os
  
  class Command(BaseCommand):
!   SHORT = _("Loads a file into the current buffer")
    def call(self, args):
      try:
        file = args[0]
      except:
!       raise CommandError,_('GET requires a file name as its first argument')
  
      if not os.path.isfile(file):
        file = file + '.sql'
***************
*** 45,51 ****
        lines = f.readlines()
        f.close()
      except (IOError, OSError), mesg:
!       raise CommandError,'Unable to open requested file:\n\n  %s' % mesg
  
      buff = []
  
--- 45,51 ----
        lines = f.readlines()
        f.close()
      except (IOError, OSError), mesg:
!       raise CommandError,_('Unable to open requested file:\n\n  %s') % mesg
  
      buff = []
  
Index: gnue-dbtools/src/sql/commands/help.py
diff -c gnue-dbtools/src/sql/commands/help.py:1.2 
gnue-dbtools/src/sql/commands/help.py:1.3
*** gnue-dbtools/src/sql/commands/help.py:1.2   Fri Sep 26 00:28:40 2003
--- gnue-dbtools/src/sql/commands/help.py       Fri Sep 26 14:07:24 2003
***************
*** 32,58 ****
  import string
  
  class Command(BaseCommand):
!   SHORT = "Shows the help screen"
    def call(self, args=()):
      try:
        command = args[0].lower()
      except:
!       command = 'help'
  
      if command == 'commands':
        lt = self.instance.commands.keys()
        lt.sort()
        mx = 0
        for l in lt:
!         mx = max(mx, len(lt))
  
        print
!       print "Available commands:"
        for l in lt:
          print "  " + string.ljust(l + ': ', mx + 3), 
self.instance.commands[l].SHORT
        print
  
!     else:
        print
!       print "Sorry, no help currently available :("
        print
--- 32,85 ----
  import string
  
  class Command(BaseCommand):
!   SHORT = _("Shows the help screen")
    def call(self, args=()):
      try:
        command = args[0].lower()
      except:
!       command = 'intro'
  
      if command == 'commands':
        lt = self.instance.commands.keys()
        lt.sort()
        mx = 0
        for l in lt:
!         mx = max(mx, len(l))
  
        print
!       print _("Available commands:")
        for l in lt:
          print "  " + string.ljust(l + ': ', mx + 3), 
self.instance.commands[l].SHORT
        print
  
!     elif command in self.instance.commands.keys():
!       print
!       print _("Help for %s command:") % command
        print
!       print "  " + 
self.instance.commands[command].help(args[1:]).replace('\n','\n  ')
        print
+ 
+     elif command == 'intro':
+       print
+       print _("""\
+ GNUe SQL Shell Help
+ ===================
+ 
+ GNUe-SQL is an interactive shell for running SQL statements against your
+ favorite database.
+ 
+ It also supports basic reporting features and data dumping.
+ 
+ * For a list of available commands, run HELP COMMANDS
+ * For help with runtime settings, run HELP SET
+ * For help with command-line parameters, run HELP SWITCHES
+ * For help with formatting fields, run HELP FORMAT
+ * For help with outputting
+ 
+ To Exit GNUe SQL Shell, enter QUIT and press RETURN.
+ """)
+     else:
+       print _("""
+ Help is currently unavailable for this topic.  Bug the developers.
+ (Or volunteer to write this module :)
+       """)
Index: gnue-dbtools/src/sql/commands/list.py
diff -c gnue-dbtools/src/sql/commands/list.py:1.1 
gnue-dbtools/src/sql/commands/list.py:1.2
*** gnue-dbtools/src/sql/commands/list.py:1.1   Fri Sep 26 00:28:40 2003
--- gnue-dbtools/src/sql/commands/list.py       Fri Sep 26 14:07:24 2003
***************
*** 30,36 ****
  from Base import BaseCommand
  
  class Command(BaseCommand):
!   SHORT = "Shows the current buffer"
    def call(self, args=()):
      i = 1
      for line in self.instance.lastbuffer:
--- 30,36 ----
  from Base import BaseCommand
  
  class Command(BaseCommand):
!   SHORT = _("Shows the current buffer")
    def call(self, args=()):
      i = 1
      for line in self.instance.lastbuffer:
Index: gnue-dbtools/src/sql/commands/save.py
diff -c gnue-dbtools/src/sql/commands/save.py:1.2 
gnue-dbtools/src/sql/commands/save.py:1.3
*** gnue-dbtools/src/sql/commands/save.py:1.2   Fri Sep 26 00:28:40 2003
--- gnue-dbtools/src/sql/commands/save.py       Fri Sep 26 14:07:24 2003
***************
*** 31,42 ****
  from Base import BaseCommand, CommandError
  
  class Command(BaseCommand):
!   SHORT = "Saves your current buffer to a file"
    def call(self, args):
      try:
        file = args[0]
      except:
!       raise CommandError,'SAVE requires a file name as its first argument'
  
      if '.' not in file[:]:
        file = file + '.sql'
--- 31,42 ----
  from Base import BaseCommand, CommandError
  
  class Command(BaseCommand):
!   SHORT = _("Saves your current buffer to a file")
    def call(self, args):
      try:
        file = args[0]
      except:
!       raise CommandError,_('SAVE requires a file name as its first argument')
  
      if '.' not in file[:]:
        file = file + '.sql'
***************
*** 45,51 ****
        f.writelines(self.instance.lastbuffer)
        f.close()
      except (IOError, OSError), mesg:
!       raise CommandError,'Unable to open requested file:\n\n  %s' % mesg
!     return "Buffer written to %s" % file
  
  
--- 45,51 ----
        f.writelines(self.instance.lastbuffer)
        f.close()
      except (IOError, OSError), mesg:
!       raise CommandError,_('Unable to open requested file:\n\n  %s') % mesg
!     return _("Buffer written to %s") % file
  
  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]