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

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

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

revision 1.1 by jcater, Fri Sep 19 21:51:48 2003 UTC revision 1.2 by jcater, Fri Sep 26 04:28:40 2003 UTC
# Line 29  Line 29 
29  #  #
30    
31  from Base import BaseCommand  from Base import BaseCommand
32    import tempfile, os, sys, string
33    
34  class Command(BaseCommand):  class Command(BaseCommand):
35      SHORT = "Opens the current buffer in an external editor"
36    def call(self, args):    def call(self, args):
37      pass      file = tempfile.mktemp()
38    
39        f = open(file,"w")
40        f.writelines(self.instance.lastbuffer)
41        f.close()
42    
43        if len(args):
44          command = string.join(args)
45        elif os.environ.has_key('EDITOR'):
46          command = os.environ['EDITOR']
47        else:
48          command = 'vi'
49    
50        os.system('%s "%s"' % (command, file))
51    
52        self.instance.commands['get'].call([file])
53        os.unlink(file)
54        return
55    
56    
57    
58    

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

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