Create shipment if it doesn't exist; exit with error if update flag not set.

- Create shipment if it doesn't exist, when the shipment and update flag are both not set.
- Print an error message and exit with error code if the "How did you get here?" case is reached.
This commit is contained in:
Kumi 2023-09-12 08:22:29 +02:00
parent e9c7ed12d3
commit 9a79d06544
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -145,7 +145,7 @@ def main():
print(f"Shipment {args.tracking_number} does not exist. Remove -u to create.") print(f"Shipment {args.tracking_number} does not exist. Remove -u to create.")
exit(1) exit(1)
else: if not shipment and not args.update:
tracker.db.create_shipment( tracker.db.create_shipment(
args.tracking_number, args.carrier, args.description args.tracking_number, args.carrier, args.description
) )
@ -153,7 +153,10 @@ def main():
f"Created shipment for {args.tracking_number} with carrier {args.carrier}" f"Created shipment for {args.tracking_number} with carrier {args.carrier}"
) )
exit(0) exit(0)
print("How did you get here?")
exit(1)
if args.tracking_number is not None: if args.tracking_number is not None:
if args.disable: if args.disable: