"""__init__.py module for the Version 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.version.version_implimportplugin_name,versionversion_aac_file_name="version.aac"
[docs]defrun_version()->ExecutionResult:"""Print the AaC package version."""result=ExecutionResult(plugin_name,"version",ExecutionStatus.SUCCESS,[])version_result=version()ifnotversion_result.is_success():returnversion_resultelse:result.add_messages(version_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()version_aac_file=join(dirname(__file__),version_aac_file_name)definitions=active_context.parse_and_load(version_aac_file)version_plugin_definition=[definitionfordefinitionindefinitionsifdefinition.name==plugin_name][0]plugin_instance=version_plugin_definition.instanceforfile_to_loadinplugin_instance.definition_sources:active_context.parse_and_load(file_to_load)plugin_runner=PluginRunner(plugin_definition=version_plugin_definition)plugin_runner.add_command_callback("version",run_version)active_context.register_plugin_runner(plugin_runner)