@@ -1169,6 +1169,20 @@ def arg_check_run_as_user(value: str) -> int:
11691169 return i_value
11701170
11711171
1172+ def validate_collection_name (argument : str ) -> str :
1173+ """Raises an ArgumentTypeError if the argument is not a valid collection name"""
1174+ if decoder .is_valid_collection_name (argument ):
1175+ return argument
1176+ raise argparse .ArgumentTypeError (f"'{ argument } ' is not a valid collection name" )
1177+
1178+
1179+ def validate_job_name (argument : str ) -> str :
1180+ """Raises an ArgumentTypeError if the argument is not a valid job name"""
1181+ if decoder .is_valid_job_name (argument ):
1182+ return argument
1183+ raise argparse .ArgumentTypeError (f"'{ argument } ' is not a valid job name" )
1184+
1185+
11721186# -----------------------------------------------------------------------------
11731187# main
11741188# -----------------------------------------------------------------------------
@@ -1194,9 +1208,13 @@ def main() -> int:
11941208 arg_parser .add_argument (
11951209 "-c" ,
11961210 "--collection" ,
1197- help = "The Job collection to test. If not"
1198- " specified the Jobs in all collections"
1211+ help = "The Job collection name to test."
1212+ " This is the collection name used by Jobs in job definition files"
1213+ " referred to by the manifest."
1214+ " It is not the name of a Job definition file."
1215+ " If not specified the Jobs in all collections found"
11991216 " will be candidates for testing." ,
1217+ type = validate_collection_name ,
12001218 )
12011219 arg_parser .add_argument (
12021220 "-j" ,
@@ -1205,6 +1223,7 @@ def main() -> int:
12051223 " is required. If not specified all the Jobs"
12061224 " that match the collection will be"
12071225 " candidates for testing." ,
1226+ type = validate_job_name ,
12081227 )
12091228 arg_parser .add_argument (
12101229 "--image-tag" ,
0 commit comments