Files
James Gross 80de840881 Even More Syntax Cleanup (#293)
A lot of cleanup things in prep for a python 3 transition. Getting rid of the old exception syntax, converting prints over to logging, cutting random scraps of code to be proper unit tests,  cut away some older bits of code, etc.

This still works in python2. It's just a lot of tidying up. There are no major functionality changes.
2020-09-08 13:00:06 -04:00

41 lines
769 B
Python

'''
A package for a basic command interpreter for the graph.
(and graph db...)
'''
import sys
import cmd
import visgraph.graphcore as vg_gcore
class GraphCli(cmd.Cmd):
def __init__(self, graph=None):
cmd.Cmd.__init__(self)
if graph is None:
graph = vg_gcore.Graph()
self.graph = graph
def do_addnode(self, line):
'''
Add a node with the given key=value properties on the CLI.
(the property nid is special and MUST be an integer)
'''
return self.graph.addNode()
def do_quit(self, line):
'''
Exit the visgraph cli....
'''
raise SystemExit()
def main():
cli = GraphCli()
cli.cmdloop()
if __name__ == '__main__':
sys.exit(main())