diff options
author | Helmut Grohne <helmut@subdivi.de> | 2016-05-21 17:54:04 +0200 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2016-05-21 17:54:04 +0200 |
commit | 4789c77936a634dc717f61309503f99a44b610ed (patch) | |
tree | 40e621b92ae1682709ce1f814ceddcbcebb727bb /readyaml.py | |
parent | 4cdf80c2ba2535f9a4a66d1bde6f7ac1b380e3d2 (diff) | |
download | debian-dedup-4789c77936a634dc717f61309503f99a44b610ed.tar.gz |
move from deprecated optparse to argparse
Diffstat (limited to 'readyaml.py')
-rwxr-xr-x | readyaml.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/readyaml.py b/readyaml.py index 2ef9a3b..b6f7316 100755 --- a/readyaml.py +++ b/readyaml.py @@ -2,7 +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 argparse import sqlite3 import sys @@ -54,12 +54,12 @@ def readyaml(db, stream): raise ValueError("missing commit block") def main(): - 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) + parser = argparse.ArgumentParser() + parser.add_argument("-d", "--database", action="store", + default="test.sqlite3", + help="path to the sqlite3 database file") + args = parser.parse_args() + db = sqlite3.connect(args.database) readyaml(db, sys.stdin) if __name__ == "__main__": |