- Upgraded manpage

- Can save relations
- Better -v printout
- Added comments


git-svn-id: http://galileo.dmi.unict.it/svn/relational/trunk@236 014f5005-505e-4b48-8d0a-63407b615a7c
master
LtWorf 2010-06-21 21:02:47 +07:00
parent a608581a33
commit f4d47a01e9
3 changed files with 42 additions and 12 deletions

@ -3,13 +3,11 @@
relational \(em Python implementation of Relational algebra.
.SH "SYNOPSIS"
.PP
\fBrelational\fR [\-v\fR\fP]
.br
\fBrelational\fR [ FILE .\|.\|.]
\fBrelational\fR [OPTIONS\fR\fP] [ FILE .\|.\|.]
.SH "DESCRIPTION"
.PP
Python implementation of Relational algebra. This program provides a GUI to execute relational algebra queries. It is meant to be used for educational purposes.
Python implementation of Relational algebra. This program provides an UI to execute relational algebra queries. It is meant to be used for educational purposes.
.SH "OPTIONS"
.PP
@ -19,6 +17,15 @@ options is included below. However, the ordering is very strict \-
.IP "\fB-v\fP
Show version information.
.IP "\fB-h\fP
Shows help.
.IP "\fB-q\fP
Using the Qt4 GUI (default).
.IP "\fB-r\fP
Uses the readline UI.
.SH "AUTHOR"
.PP
This manual page was written by Salvo 'LtWorf' Tomaselli <tiposchi@tiscali.it> for
@ -26,4 +33,3 @@ the \fBDebian GNU/Linux\fP system (but may be used by others). Permission is
granted to copy, distribute and/or modify this document under
the terms of the GNU General Public License
version 3 or any later version published by the Free Software Foundation.
.\" created by instant / docbook-to-man, Fri 10 Oct 2008, 19:02

@ -27,15 +27,20 @@ from relational import relation, parser
version="0.11"
def printver():
print "Relational"
def printver(exit=True):
print "Relational %s" % version
print "Copyright (C) 2008 Salvo 'LtWorf' Tomaselli."
print
print "This program comes with ABSOLUTELY NO WARRANTY."
print "This is free software, and you are welcome to redistribute it"
print "under certain conditions."
print "For details see the GPLv3 Licese."
print
print "Version: %s"%version
sys.exit(0)
print "Written by Salvo 'LtWorf' Tomaselli <tiposchi@tiscali.it>"
print
print "http://galileo.dmi.unict.it/wiki/relational/doku.php"
if exit:
sys.exit(0)
def printhelp(code=0):
print "Relational"
@ -105,6 +110,7 @@ if __name__ == "__main__":
Form.show()
sys.exit(app.exec_())
else:
printver(False)
import relational_readline.linegui
relational_readline.linegui.main(files)

@ -178,9 +178,25 @@ def exec_line(command):
else:
print "No such relation %s" % pars[1]
pass
#elif command=='SAVE': //TODO
elif command.startswith('SAVE'):
pars=command.split(' ')
if len(pars)!=3:
print "Missing parameter"
return
filename=pars[1]
defname=pars[2]
if defname not in relations:
print "No such relation %s" % defname
return
try:
relations[defname].save(filename)
except Exception,e:
print e
else:
exec_query( command)
exec_query(command)
def replacements(query):
'''This funcion replaces ascii easy operators with the correct ones'''
@ -247,6 +263,8 @@ def exec_query(command):
print e
def main(files=[]):
print "> ; Type HELP to get the HELP"
print "> ; Completion is activated using the tab"
for i in files:
load_relation(i)
@ -261,7 +279,7 @@ def main(files=[]):
while True:
try:
line = raw_input('> ')
if isinstance(line,str) and len(line)>0:
if isinstance(line,str) and len(line)>0 and not line.startswith(';'):
exec_line(line)
except EOFError:
print