feat(tldr.py): enhance TLDR command with caching, platform detection,… by kzndotsh · Pull Request #859 · allthingslinux/tux
… and improved Discord integration Introduce a comprehensive TLDR client to manage fetching, caching, and displaying TLDR pages. This includes support for multiple languages and platforms, with automatic cache updates and platform detection. The Discord integration is improved with pagination for long pages and autocomplete for command and platform inputs. These changes aim to enhance user experience by providing faster access to TLDR pages, supporting more platforms and languages, and offering a more interactive Discord interface.
Extract TLDR client logic into a separate module to improve code organization and maintainability. This change separates the core TLDR functionality from Discord-specific UI components, allowing for easier testing and potential reuse in non-Discord contexts. The refactor also includes improvements to caching logic, platform detection, and language handling, enhancing the overall robustness and flexibility of the TLDR integration.
…up process Remove the unused `cog_watcher` attribute from the `Tux` class to clean up the code. This attribute was not being utilized effectively and its removal simplifies the class structure. Additionally, improve the setup process by ensuring that cogs and hot reload systems are initialized in a more structured manner, enhancing maintainability and readability. fix(cogs): update import paths for generate_usage function Change import paths for `generate_usage` from `tux.utils.flags` to `tux.utils.functions` across multiple cog files. This change reflects the relocation of the `generate_usage` function to a more appropriate module, improving code organization and clarity. feat(bot.py): add on_ready event handler to set bot status Introduce an `on_ready` event handler in the `Tux` class to set the bot's status to "watching for /help" when the bot is ready. This provides users with a clear indication of the bot's availability and primary command. refactor(hot_reload.py): enhance hot reload system with dependency tracking and error handling Significantly enhance the hot reload system by introducing smart dependency tracking, improved error handling, and performance monitoring. This includes the addition of a `DependencyGraph` class for managing module dependencies, a `FileHashTracker` for change detection, and a `ClassDefinitionTracker` for hot patching capabilities. These improvements make the hot reload system more robust and efficient, allowing for better management of code changes and reducing the risk of errors during reloads.
The command parameter is now explicitly separated from flags, improving readability and understanding of the function's parameters. This change also includes a more descriptive docstring for the command parameter. fix(flags.py): remove command flag from TldrFlags and add aliases The command flag is removed from TldrFlags as it is now a separate parameter in the prefix_tldr function. Aliases are added to other flags for better usability and flexibility. feat(hot_reload.py): add syntax validation before hot reload Introduces a function to validate Python syntax before attempting a hot reload, preventing unnecessary reloads and Sentry spam due to syntax errors. Also, adds a mechanism to filter out common development errors from being sent to Sentry, reducing noise in error tracking. These changes improve code clarity, usability, and robustness by ensuring that only valid Python files are reloaded and reducing unnecessary error reporting.
Update the gitleaks pre-commit hook to the latest version to ensure the latest security checks and improvements are included. This helps maintain the security and integrity of the codebase by using the most up-to-date version of the tool.
…ling Remove the tealdeer package from the Dockerfile as it is no longer required. Instead, create a TLDR cache directory with appropriate permissions for the nonroot user. This change ensures that the application image is leaner by removing unnecessary packages and improves security by setting up the cache directory with the correct permissions for the nonroot user.
Introduce a new Discord cog for TLDR command integration, enabling users to fetch TLDR pages for CLI commands directly within Discord. This feature supports both slash and prefix commands, providing flexibility in usage. It includes autocomplete for command, platform, and language parameters, enhancing user experience by making it easier to find the desired TLDR pages. The cog also manages cache updates to ensure users receive the most recent information. This enhancement aims to improve the bot's utility by offering quick access to command usage summaries, which is especially useful for users who frequently work with command-line tools.
kzndotsh
marked this pull request as ready for review
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters