vimana-framework
vimana-framework copied to clipboard
Automate Menu Help Updates
Description: As the framework grows and gains complexity, it has become challenging to keep the menus updated. For instance, if a new command is added, the instructions on how to use it may take time to be updated, resulting in outdated help menus compared to the framework's resources. Currently, this is done in a very rudimentary way, requiring manual editing of several files and modules to work as expected.
Technical Details: Implement a dynamic system to automatically update the help menus when new commands are added. Use a configuration file or a centralized registry to store command descriptions. Modify the vmnf_helpers.py file to read from this configuration file or registry. Ensure that the help menu is generated dynamically based on the current commands and their descriptions.
Proposed Solution: Command Metadata Annotations: Use decorators to annotate command functions with metadata, including descriptions. This metadata can be automatically extracted to update the help menus. Documentation Generation Tool: Integrate a documentation generation tool (e.g., Sphinx) to automatically generate and update help menus based on the codebase. Database Integration: Store command descriptions in a database and create an API to fetch and update these descriptions dynamically.
Example of Command Metadata Annotations:
commands_registry = {}
def command(description):
def decorator(func):
commands_registry[func.__name__] = description
return func
return decorator
@command("Run a resource, plugin or case")
def run():
pass
@command("Start Vimana in an interactive mode")
def start():
pass
Benefits:
- Reduces the risk of outdated help menus.
- Simplifies the process of adding new commands.
- Improves maintainability and scalability of the framework.
- Provides a more robust and automated solution for managing command descriptions.
Future Considerations:
- Explore integrating with a documentation generation tool like Sphinx.
- Consider using a database to store command descriptions and create an API for dynamic updates.