From 9a79d06544401a5c701ed035317c93f589eb4f31 Mon Sep 17 00:00:00 2001 From: Kumi Date: Tue, 12 Sep 2023 08:22:29 +0200 Subject: [PATCH] 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. --- src/trackbert/__main__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/trackbert/__main__.py b/src/trackbert/__main__.py index 3b537c2..8470d7a 100644 --- a/src/trackbert/__main__.py +++ b/src/trackbert/__main__.py @@ -145,7 +145,7 @@ def main(): print(f"Shipment {args.tracking_number} does not exist. Remove -u to create.") exit(1) - else: + if not shipment and not args.update: tracker.db.create_shipment( args.tracking_number, args.carrier, args.description ) @@ -153,7 +153,10 @@ def main(): 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.disable: