diff options
| author | Terry Truong <terry06890@gmail.com> | 2022-08-20 13:16:21 +1000 |
|---|---|---|
| committer | Terry Truong <terry06890@gmail.com> | 2022-08-20 13:16:21 +1000 |
| commit | 930c12d33e1093f874a4beb4d6376621e464e8c0 (patch) | |
| tree | 381722fc3ab9ebda482cb18d29e1091458aa93da /backend/tolData/addPickedNames.py | |
| parent | 8144003565797f0d18645a416b95d4365bba5fdd (diff) | |
Use argparse in python scripts
Diffstat (limited to 'backend/tolData/addPickedNames.py')
| -rwxr-xr-x | backend/tolData/addPickedNames.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/backend/tolData/addPickedNames.py b/backend/tolData/addPickedNames.py index d56a0cb..9b56422 100755 --- a/backend/tolData/addPickedNames.py +++ b/backend/tolData/addPickedNames.py @@ -3,14 +3,11 @@ import sys import sqlite3 -usageInfo = f""" -Usage: {sys.argv[0]} - -Reads alt-name data from a file, and adds it to the database's 'names' table. -""" -if len(sys.argv) > 1: - print(usageInfo, file=sys.stderr) - sys.exit(1) +import argparse +parser = argparse.ArgumentParser(description=""" +Reads alt-name data from a file, and adds it to the database's 'names' table +""", formatter_class=argparse.RawDescriptionHelpFormatter) +parser.parse_args() dbFile = "data.db" pickedNamesFile = "pickedNames.txt" |
