@@ -245,6 +245,7 @@ def level_rank(level: str) -> int:
245245
246246def parse_args () -> argparse .Namespace :
247247 p = argparse .ArgumentParser (description = "Release notes monitor with high-risk scoring" )
248+ p .add_argument ("targets" , nargs = "*" , help = "Optional source filters, for example: citrix vmware sonicwall" )
248249 p .add_argument ("--json" , action = "store_true" , help = "Legacy JSON switch" )
249250 p .add_argument ("--output" , choices = ["text" , "json" , "markdown" ], default = "text" , help = "Output format" )
250251 p .add_argument ("--alert-on" , choices = ["low" , "medium" , "high" , "none" ], default = "none" , help = "Exit non-zero if any item meets threshold" )
@@ -253,6 +254,21 @@ def parse_args() -> argparse.Namespace:
253254 return p .parse_args ()
254255
255256
257+ def select_sources (target_filters : list [str ]) -> list [Source ]:
258+ if not target_filters :
259+ return SOURCES
260+
261+ filters = [f .strip ().lower () for f in target_filters if f .strip ()]
262+ selected : list [Source ] = []
263+
264+ for source in SOURCES :
265+ hay = f"{ source .name } { source .product } " .lower ()
266+ if any (f in hay for f in filters ):
267+ selected .append (source )
268+
269+ return selected
270+
271+
256272def render_markdown (updates : list [ReleaseInfo ]) -> str :
257273 if not updates :
258274 return "No new releases detected."
@@ -280,11 +296,19 @@ def main() -> int:
280296 ensure_dependencies ()
281297 kev_set = load_kev_set ()
282298
299+ active_sources = select_sources (args .targets )
300+ if not active_sources :
301+ print ("No matching sources for provided targets." , file = sys .stderr )
302+ print ("Available source names:" , file = sys .stderr )
303+ for s in SOURCES :
304+ print (f"- { s .name } " , file = sys .stderr )
305+ return 1
306+
283307 old_state = {} if args .no_state else load_state ()
284308 new_state : dict = {}
285309 updates : list [ReleaseInfo ] = []
286310
287- for source in SOURCES :
311+ for source in active_sources :
288312 try :
289313 html = fetch (source .url )
290314 text = text_from_html (html )
0 commit comments