aboutsummaryrefslogtreecommitdiff
path: root/backend/tolData/genLinkedImgs.py
diff options
context:
space:
mode:
authorTerry Truong <terry06890@gmail.com>2022-08-20 13:16:21 +1000
committerTerry Truong <terry06890@gmail.com>2022-08-20 13:16:21 +1000
commit930c12d33e1093f874a4beb4d6376621e464e8c0 (patch)
tree381722fc3ab9ebda482cb18d29e1091458aa93da /backend/tolData/genLinkedImgs.py
parent8144003565797f0d18645a416b95d4365bba5fdd (diff)
Use argparse in python scripts
Diffstat (limited to 'backend/tolData/genLinkedImgs.py')
-rwxr-xr-xbackend/tolData/genLinkedImgs.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/backend/tolData/genLinkedImgs.py b/backend/tolData/genLinkedImgs.py
index c9cc622..eb991b9 100755
--- a/backend/tolData/genLinkedImgs.py
+++ b/backend/tolData/genLinkedImgs.py
@@ -3,15 +3,12 @@
import sys, re
import sqlite3
-usageInfo = f"""
-Usage: {sys.argv[0]}
-
+import argparse
+parser = argparse.ArgumentParser(description="""
Look for nodes without images in the database, and tries to
-associate them with images from their children.
-"""
-if len(sys.argv) > 1:
- print(usageInfo, file=sys.stderr)
- sys.exit(1)
+associate them with images from their children
+""", formatter_class=argparse.RawDescriptionHelpFormatter)
+parser.parse_args()
dbFile = "data.db"
compoundNameRegex = re.compile(r"\[(.+) \+ (.+)]")