-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenealogy.py
More file actions
executable file
·24 lines (19 loc) · 817 Bytes
/
Copy pathgenealogy.py
File metadata and controls
executable file
·24 lines (19 loc) · 817 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from db import dbase
from search import depthSearch
from display import graphVIZ
from optparse import OptionParser
def optsearch(option, opt, value, parser):
dbase.startDatabase()
depthSearch(value)
dbase.stopDatabase()
def optdisplay(option, opt, value, parser):
dbase.startDatabase()
print graphVIZ(value)
dbase.stopDatabase()
if __name__ == "__main__":
parser = OptionParser("%prog [Operation] [Arguments]", version="%prog 0.1")
parser.add_option("-s", "--search", type="int", dest="id", help="search genealogy of Ph. D. with ID", action="callback", callback=optsearch)
parser.add_option("-d", "--display", type="int", dest="id", help="display genealogy of Ph. D. with ID", action="callback", callback=optdisplay)
(options, args) = parser.parse_args()