diff --git a/trestlebot/entrypoints/create_cd.py b/trestlebot/entrypoints/create_cd.py index 0ce9315f..abbddee6 100644 --- a/trestlebot/entrypoints/create_cd.py +++ b/trestlebot/entrypoints/create_cd.py @@ -23,6 +23,7 @@ from trestlebot.tasks.regenerate_task import RegenerateTask from trestlebot.tasks.rule_transform_task import RuleTransformTask from trestlebot.transformers.yaml_transformer import ToRulesYAMLTransformer +from trestlebot.const import RULES_VIEW_DIR class CreateCDEntrypoint(EntrypointBase): @@ -53,6 +54,19 @@ def setup_set_default_component_fields_arguments(self) -> None: default="service", help="Type of component definition", ) + self.parser.add_argument( + "--generate", + required=False, + default=False, + help="Generate markdown and ssp index", + ) + self.parser.add_argument( + "--transform-rules", + required=False, + default=False, + help="Transform rules to YAML", + ) + def run(self, args: argparse.Namespace) -> None: """Run the entrypoint.""" @@ -64,25 +78,25 @@ def run(self, args: argparse.Namespace) -> None: args.comp_description, args.cd_type, ) - - transformer: ToRulesYAMLTransformer = ToRulesYAMLTransformer() - - rule_transform_task: RuleTransformTask = RuleTransformTask( - args.working_dir, - args.rules_view_path, - transformer, - comma_sep_to_list(args.skip_items), - ) - pre_tasks: List[TaskBase] = [rule_transform_task] - - regenerate_task = RegenerateTask( - args.working_dir, - args.oscal_model, - args.markdown_path, - args.ssp_index_path, - comma_sep_to_list(args.skip_items), - ) - pre_tasks.append(regenerate_task) + pre_tasks: List[TaskBase] = [] + if args.transform_rules: + transformer: ToRulesYAMLTransformer = ToRulesYAMLTransformer() + rule_transform_task: RuleTransformTask = RuleTransformTask( + args.working_dir, + args.RULES_VIEW_DIR, + transformer, + comma_sep_to_list(args.skip_items), + ) + pre_tasks: List[TaskBase] = [rule_transform_task] + if args.generate: + regenerate_task = RegenerateTask( + args.working_dir, + "compdef", + args.markdown_path, + args.ssp_index_path, + comma_sep_to_list(args.skip_items), + ) + pre_tasks.append(regenerate_task) super().run_base(args, pre_tasks)