blob: 892bc4cfe4d3a0a2c93b1ddc8c3a76b08bc1f5f7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#!/usr/bin/python
import sys
import fileinput
import xboomx.db
def main():
# get db type
db_type = ''
if len(sys.argv) > 1:
db_type = sys.argv[1]
# open db
db = xboomx.db.open_shelve(db_type)
# get item to update
item = fileinput.input([]).next()
item = item.strip('\n')
# update item
db[item] = db.get(item, 0) + 1
# print it
print item
# clean up
db.sync()
db.close()
main()
|