Quick implementation of adding shipment to db
This commit is contained in:
parent
ab325de5a6
commit
c2963ef041
1 changed files with 18 additions and 0 deletions
18
trackbert.py
18
trackbert.py
|
@ -4,6 +4,7 @@ import sqlite3
|
||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import argparse
|
||||||
|
|
||||||
|
|
||||||
def notify(title, message):
|
def notify(title, message):
|
||||||
|
@ -118,4 +119,21 @@ def main():
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
|
||||||
|
parser.add_argument("--tracking-number", "-n", type=str, required=False)
|
||||||
|
parser.add_argument("--carrier", "-c", type=str, required=False)
|
||||||
|
parser.add_argument("--description", "-d", type=str, required=False)
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
if args.tracking_number is not None and args.carrier is not None:
|
||||||
|
db = get_db()
|
||||||
|
create_shipment(db, args.tracking_number, args.carrier, args.description)
|
||||||
|
print(f"Created shipment for {args.tracking_number} with carrier {args.carrier}")
|
||||||
|
exit(0)
|
||||||
|
|
||||||
|
if args.tracking_number is not None:
|
||||||
|
print("You must specify a carrier with -c")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Reference in a new issue