| @@ 18-35 (lines=18) @@ | ||
| 15 | REMEDIATION_LANGS = list(ssg.build_remediations.REMEDIATION_TO_EXT_MAP) |
|
| 16 | ||
| 17 | ||
| 18 | def parse_args(): |
|
| 19 | parser = argparse.ArgumentParser() |
|
| 20 | parser.add_argument("-j", "--json", type=str, action="store", default="build/rule_dirs.json", |
|
| 21 | help="File to read json output of rule_dir_json from (defaults " |
|
| 22 | "to build/rule_dirs.json)") |
|
| 23 | parser.add_argument("rule_id", type=str, help="Rule to change, by id") |
|
| 24 | parser.add_argument("fix_lang", choices=REMEDIATION_LANGS, help="Remediation to change") |
|
| 25 | parser.add_argument("action", choices=['add', 'remove', 'list', 'replace', 'delete', 'make_shared', 'diff'], |
|
| 26 | help="Rule to change, by id") |
|
| 27 | parser.add_argument("products", type=str, nargs='*', |
|
| 28 | help="Products or platforms to perform action with on rule_id. For replace, " |
|
| 29 | "the expected format is " |
|
| 30 | "platform[,other_platform]~platform[,other_platform] " |
|
| 31 | "where the first half is the platforms that are required to " |
|
| 32 | "match, and are replaced by the platforms in the second half " |
|
| 33 | "if all match. Add and remove require platforms and only apply " |
|
| 34 | "to the shared OVAL; delete, make_shared, and diff require products.") |
|
| 35 | return parser.parse_args() |
|
| 36 | ||
| 37 | ||
| 38 | def list_platforms(rule_obj, lang): |
|
| @@ 17-33 (lines=17) @@ | ||
| 14 | SSG_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) |
|
| 15 | ||
| 16 | ||
| 17 | def parse_args(): |
|
| 18 | parser = argparse.ArgumentParser() |
|
| 19 | parser.add_argument("-j", "--json", type=str, action="store", default="build/rule_dirs.json", |
|
| 20 | help="File to read json output of rule_dir_json from (defaults " |
|
| 21 | "to build/rule_dirs.json)") |
|
| 22 | parser.add_argument("rule_id", type=str, help="Rule to change, by id") |
|
| 23 | parser.add_argument("action", choices=['add', 'remove', 'list', 'replace', 'delete', 'make_shared', 'diff'], |
|
| 24 | help="Rule to change, by id") |
|
| 25 | parser.add_argument("products", type=str, nargs='*', |
|
| 26 | help="Products or platforms to perform action with on rule_id. For replace, " |
|
| 27 | "the expected format is " |
|
| 28 | "platform[,other_platform]~platform[,other_platform] " |
|
| 29 | "where the first half is the platforms that are required to " |
|
| 30 | "match, and are replaced by the platforms in the second half " |
|
| 31 | "if all match. Add and remove require platforms and only apply " |
|
| 32 | "to the shared OVAL; delete, make_shared, and diff require products.") |
|
| 33 | return parser.parse_args() |
|
| 34 | ||
| 35 | ||
| 36 | def list_platforms(rule_obj): |
|
| @@ 15-30 (lines=16) @@ | ||
| 12 | SSG_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) |
|
| 13 | ||
| 14 | ||
| 15 | def parse_args(): |
|
| 16 | parser = argparse.ArgumentParser() |
|
| 17 | parser.add_argument("-j", "--json", type=str, action="store", default="build/rule_dirs.json", |
|
| 18 | help="File to read json output of rule_dir_json from (defaults " |
|
| 19 | "to build/rule_dirs.json)") |
|
| 20 | parser.add_argument("rule_id", type=str, help="Rule to change, by id") |
|
| 21 | parser.add_argument("action", choices=['add', 'remove', 'list', 'replace'], |
|
| 22 | help="Rule to change, by id") |
|
| 23 | parser.add_argument("products", type=str, nargs='*', |
|
| 24 | help="Products to perform action with on rule_id. For replace, " |
|
| 25 | "the expected format is " |
|
| 26 | "product[,other_product]~product[,other_product] " |
|
| 27 | "where the first half is the products that are required to " |
|
| 28 | "match, and are replaced by the products in the second half " |
|
| 29 | "if all match.") |
|
| 30 | return parser.parse_args() |
|
| 31 | ||
| 32 | ||
| 33 | def list_products(rule_obj): |
|