summaryrefslogtreecommitdiff
path: root/readyaml.py
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2013-09-02 18:51:20 +0200
committerHelmut Grohne <helmut@subdivi.de>2013-09-02 18:51:20 +0200
commit022985f098a206c3b7852fe08a798cd31623f10d (patch)
tree84a1a0b0a67fa95608641f8e47bd55e8c1cd11fb /readyaml.py
parentc0cd9df1e6cb63d524939028f5f6a07c2c8c3da5 (diff)
downloaddebian-dedup-022985f098a206c3b7852fe08a798cd31623f10d.tar.gz
add option -d --database for db path to all scripts
Diffstat (limited to 'readyaml.py')
-rwxr-xr-xreadyaml.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/readyaml.py b/readyaml.py
index 21b1ca1..2ef9a3b 100755
--- a/readyaml.py
+++ b/readyaml.py
@@ -2,6 +2,7 @@
"""This tool reads a yaml file as generated by importpkg.py on stdin and
updates the database with the contents."""
+import optparse
import sqlite3
import sys
@@ -53,7 +54,12 @@ def readyaml(db, stream):
raise ValueError("missing commit block")
def main():
- db = sqlite3.connect("test.sqlite3")
+ parser = optparse.OptionParser()
+ parser.add_option("-d", "--database", action="store",
+ default="test.sqlite3",
+ help="path to the sqlite3 database file")
+ options, args = parser.parse_args()
+ db = sqlite3.connect(options.database)
readyaml(db, sys.stdin)
if __name__ == "__main__":