"""__init__.py module for the Print AaC Definitions plugin."""# WARNING - DO NOT EDIT - YOUR CHANGES WILL NOT BE PROTECTED.# This file is auto-generated by the aac gen-plugin and may be overwritten.fromos.pathimportjoin,dirnamefromaac.execute.aac_execution_resultimport(ExecutionResult,ExecutionStatus,)fromaac.executeimporthookimplfromaac.context.language_contextimportLanguageContextfromaac.execute.plugin_runnerimportPluginRunnerfromaac.plugins.print_defs.print_aac_definitions_implimportplugin_name,print_defsprint_aac_definitions_aac_file_name="print_aac_definitions.aac"
[docs]defrun_print_defs(core_only)->ExecutionResult:"""Print YAML representation of AaC language definitions."""result=ExecutionResult(plugin_name,"print-defs",ExecutionStatus.SUCCESS,[])print_defs_result=print_defs(core_only)ifnotprint_defs_result.is_success():returnprint_defs_resultelse:result.add_messages(print_defs_result.messages)returnresult
[docs]@hookimpldefregister_plugin()->None:""" Returns information about the plugin. Returns: A collection of information about the plugin and what it contributes. """active_context=LanguageContext()print_aac_definitions_aac_file=join(dirname(__file__),print_aac_definitions_aac_file_name)definitions=active_context.parse_and_load(print_aac_definitions_aac_file)print_aac_definitions_plugin_definition=[definitionfordefinitionindefinitionsifdefinition.name==plugin_name][0]plugin_instance=print_aac_definitions_plugin_definition.instanceforfile_to_loadinplugin_instance.definition_sources:active_context.parse_and_load(file_to_load)plugin_runner=PluginRunner(plugin_definition=print_aac_definitions_plugin_definition)plugin_runner.add_command_callback("print-defs",run_print_defs)active_context.register_plugin_runner(plugin_runner)