# HG changeset patch # User catherine@DellZilla # Date 1255649954 14400 # Node ID 83185d382d106b78f093afb56296fc0f47d08748 # Parent 22c96b70ee41231ae3342e9434c73d932cff54f7 changed do_psql diff -r 22c96b70ee41 -r 83185d382d10 sqlpython/sqlpyPlus.py --- a/sqlpython/sqlpyPlus.py Thu Oct 15 18:52:33 2009 -0400 +++ b/sqlpython/sqlpyPlus.py Thu Oct 15 19:39:14 2009 -0400 @@ -1202,21 +1202,20 @@ commands = {} for c in self.do_psql.__doc__.splitlines()[2:]: (abbrev, command) = c.split(None, 1) - commands[abbrev[1:]] = command - words = arg.split(None,1) - try: - abbrev = words[0] - except IndexError: - return + commands[abbrev] = command + parts = arg.parsed.raw.split(None,1) + abbrev = parts[0] try: - args = words[1] + remainder = parts[1] except IndexError: - args = '' - try: - return self.onecmd('%s %s%s%s' % (commands[abbrev], args, arg.parsed.terminator, arg.parsed.suffix)) - except KeyError: - self.perror('psql command \%s not yet supported.' % abbrev) - + remainder = '' + if abbrev in commands: + newcommand = '%s %s' % (commands[abbrev], remainder) + return self.onecmd(newcommand) + else: + self.perror('No abbreviated command for %s' % abbrev) + self.perror(self.do_psql.__doc__) + def _do_dir(self, type, arg, opts): self.do_ls("%s/%s%s%s" % (type, str(arg), arg.parsed.terminator, arg.parsed.suffix), opts)