How andyhoang/athena-cli works
Main Components
• CLI Entry Point: Represent the main executable (src/main.rs) which initializes the application.
• Configuration Manager: Show the configuration handling (src/config.rs and usage of config.example.toml copied to ~/.config/athena-cli/config.toml) that sets up AWS credentials, default workgroup, and output settings.
• Command Dispatcher: Indicate that the app uses a modular command pattern. Highlight the CLI parser (src/cli.rs) and the “commands” modules (located in src/commands). Each subdirectory (e.g., database, history, inspect) represents a group of commands.
• AWS Integration Module: Include the AWS-related interactions from src/aws.rs that handle communication with AWS Athena.
• Commands and Utilities: Represent the specialized command modules (e.g., query execution, database listing/description, workgroup management, query history, and inspect/download functionality). Also include supporting utilities (e.g., src/utils) that help with filtering or displaying results.
• Internal Context/Data Model: Show the role of src/context.rs and src/lib.rs which likely maintain application state or common data structures across commands.
• External Interaction: Emphasize that the CLI interacts with AWS Athena as an external service (also hint at the use of Polars for DataFrame handling, as noted in the README).
Relationships and Interactions
• From the CLI Parser, branch out to the appropriate command module (database, query, history, inspect, or workgroup).
• Each command module processes its logic and may invoke functionality from:
• The AWS Interaction Module for executing queries or retrieving metadata from AWS Athena.
• The Configuration Manager to access user settings.
• The Context component to share state/information across commands.
• Utility modules to handle formatting and output tasks.
Architectural Patterns and Principles
• Modular Command Pattern: The project neatly divides different functionalities into sub-commands (database, history, inspect, etc.), each encapsulated in its own module.
• Separation of Concerns: The design separates user interface (CLI parsing), business logic (commands and AWS interactions), and configuration management.
Detailed Elements to Add
• Flow from the CLI command execution to the actual call to AWS Athena and demonstrate how results are processed and returned.
• Hexagons for command modules.
• Rectangles for core logic components.