Add handling for existing shipments and improve update functionality in __main__.py
The current code adds handling for existing shipments and improves the update functionality in the `__main__.py` file. The changes include checking if a shipment already exists, updating the shipment with the specified carrier, and printing appropriate messages.
This commit is contained in:
parent
ecc540ab6e
commit
f7e9c76f64
1 changed files with 2 additions and 1 deletions
|
@ -127,7 +127,7 @@ def main():
|
|||
|
||||
if args.tracking_number is not None and args.carrier is not None:
|
||||
if (
|
||||
shipment := tracker.db.get_shipment(args.tracking_number)
|
||||
(shipment := tracker.db.get_shipment(args.tracking_number))
|
||||
and not args.update
|
||||
):
|
||||
print(f"Shipment {args.tracking_number} already exists. Use -u to update.")
|
||||
|
@ -140,6 +140,7 @@ def main():
|
|||
print(
|
||||
f"Updated shipment for {args.tracking_number} with carrier {args.carrier}"
|
||||
)
|
||||
exit(0)
|
||||
|
||||
if not shipment and args.update:
|
||||
print(f"Shipment {args.tracking_number} does not exist. Remove -u to create.")
|
||||
|
|
Loading…
Reference in a new issue