From 3d97aa45cb537621af250e36abf18c29eed1677e Mon Sep 17 00:00:00 2001
From: XANTRONIX Industrial <xan@xantronix.com>
Date: Sat, 19 Apr 2025 12:12:34 -0400
Subject: [PATCH] Ensure either --file or --valid and --day are given

---
 bin/xmet-spc-render | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/bin/xmet-spc-render b/bin/xmet-spc-render
index 2998f9c..e59523d 100755
--- a/bin/xmet-spc-render
+++ b/bin/xmet-spc-render
@@ -1,5 +1,6 @@
 #! /usr/bin/env python3
 
+import sys
 import argparse
 import cairo
 
@@ -71,6 +72,8 @@ argparser = argparse.ArgumentParser(description='Render graphical SPC outlooks f
 argparser.add_argument('--dark',   action='store_true', help='Output dark mode graphics')
 argparser.add_argument('--cities', action='store_true', help='Render major cities')
 argparser.add_argument('--file',        type=str, help='Load outlook from file, not database')
+
+group_day_valid = argparser.add_argument_group('group_day_valid', 'SPC outlook from database')
 argparser.add_argument('--valid',       type=str, help='Timestamp on or after most recent outlook')
 argparser.add_argument('--day',         type=int, help='Number of days from issuance outlook applies to')
 argparser.add_argument('--categorical', type=str, help='Output categorical risk graphic file')
@@ -87,6 +90,10 @@ db     = Database.from_config(config)
 conus  = SPCOutlookMap(args.dark)
 
 if args.file is None:
+    if args.valid is None or args.day is None:
+        print("Must specify either --file or --valid and --day", file=sys.stderr)
+        exit(1)
+
     outlook = SPCOutlook.for_timestamp(db, args.valid, args.day)
 else:
     with open(args.file, 'r') as fh: