@@ -1106,6 +1106,13 @@ def main(argv=None):
11061106 "--name" ,
11071107 help = "Owner label name for gh-task when using --project." ,
11081108 )
1109+ task_parser .add_argument (
1110+ "--only-matching" ,
1111+ help = (
1112+ "When using --project, only take issues whose title matches this regex. "
1113+ "Useful for filtering tasks by hardware encoded in the issue title/path."
1114+ ),
1115+ )
11091116 task_parser .add_argument (
11101117 "task_args" ,
11111118 nargs = "*" ,
@@ -1419,6 +1426,11 @@ def main(argv=None):
14191426 raise SystemExit ("--name is required with --project." )
14201427 if not args .task_args :
14211428 raise SystemExit ("task --project requires one or more task files." )
1429+ if args .only_matching is not None :
1430+ try :
1431+ re .compile (args .only_matching )
1432+ except re .error as exc :
1433+ raise SystemExit (f"--only-matching regex is invalid: { exc } " ) from None
14221434 from .gh_integration import GhTaskRunner , project_url
14231435 from gh_task .errors import TakeError
14241436
@@ -1430,6 +1442,7 @@ def main(argv=None):
14301442 args .name ,
14311443 args .task_args ,
14321444 args .status ,
1445+ args .only_matching ,
14331446 args .cwd ,
14341447 args .yolo ,
14351448 args .flags ,
@@ -1457,6 +1470,7 @@ def main(argv=None):
14571470 args .name ,
14581471 args .task_args ,
14591472 args .status ,
1473+ args .only_matching ,
14601474 args .cwd ,
14611475 args .yolo ,
14621476 args .flags ,
@@ -1482,6 +1496,8 @@ def main(argv=None):
14821496 raise SystemExit (
14831497 "task -f --item requires {{item}} in the task file."
14841498 )
1499+ if args .only_matching is not None :
1500+ raise SystemExit ("--only-matching is only supported with --project." )
14851501 if args .check is not None :
14861502 raise SystemExit ("--check is not allowed with -f." )
14871503 if args .max_iterations is not None :
@@ -1553,6 +1569,8 @@ def main(argv=None):
15531569 raise SystemExit ("--loop is only supported with -p." )
15541570 if args .item is not None :
15551571 raise SystemExit ("--item is only supported with -f." )
1572+ if args .only_matching is not None :
1573+ raise SystemExit ("--only-matching is only supported with --project." )
15561574 if args .max_iterations is None :
15571575 args .max_iterations = DEFAULT_MAX_ITERATIONS
15581576 if args .max_iterations < 0 :
0 commit comments