code: def do_edit(self, args):
          
          if 'EDITOR' not in os.environ:
              print('*** $EDITOR not set')
          else:
              path = os.path.join(utils.CONFIG_DIR, 'sql')
              cmd = os.environ['EDITOR']
              try:
                  os.system(cmd + ' ' + path)
                  if os.path.exists(path):
                      with open(path, 'r') as f:
                          sql = f.read()
                          if sql:
                              self.default(sql)
              finally:
                  if os.path.exists(path):
                      os.remove(path)
docs: Edit a command with $EDITOR.