Enhanced the documentation to detail multiple ways to exclude files and directories from the hosts.d processing. This update introduces three additional methods alongside the existing `.disabled` extension approach: ignoring hidden files and directories, utilizing a specific `HOSTSD_IGNORE` magic string within a file, and automatically excluding binary files. This comprehensive guide ensures users have various options to tailor file inclusion to their specific needs, contributing to a more flexible and user-friendly configuration process. This change addresses the need for clearer guidance on managing file exclusions effectively.
Upgraded project version to 0.1.3 in pyproject.toml, streamlining the process for future updates and enhancements. Simplified file listing mechanism in __main__.py by switching from using glob("**/*") to iterdir(), enhancing performance and maintainability. This change focuses on optimizing the directory scanning to include only the immediate files, reducing overhead on directory parsing which can be beneficial for large directories.
Upgraded hostsd to version 0.1.2, introducing logic to skip over directories that are either hidden (start with a '.') or intentionally disabled (end with '.disabled') during the directory reading process. This exclusion strategy enhances the performance by reducing unnecessary processing and aligns with common practices to temporarily disable directories without removing them. This update ensures a cleaner and more efficient directory scanning, particularly in environments where such control directories are prevalent.
Added instructions for safely retaining the original /etc/hosts file by copying it to a new directory (`/etc/hosts.d/`) before modifications. This ensures users won't lose their existing configurations when beginning to use the `hostsd` tool. By creating a backup in `/etc/hosts.d/00-original`, users have a straightforward way to review or restore their original settings.
This change addresses the need for a non-destructive setup process, making it easier and safer for users to integrate `hostsd` into their existing system configurations without the fear of losing important entries already present in their `/etc/hosts` file.
Refactored the hosts file generation logic to improve its functionality and readability. Introduced a more robust file reading system that recursively reads all text files in a given directory, excluding ones starting with a period, ending with `.disabled`, or containing the `HOSTSD IGNORE` marker. This enhancement helps in accommodating a broader range of file organizations and simplifying the exclusion of specific files from the hosts file generation process. Additionally, updated the version to 0.1.1 to mark this incremental improvement.
- Improved file reading by handling nested directories and providing options to ignore certain files.
- Added capability to prefix file paths in the generated content, enhancing traceability of file origins.
- Streamlined error handling for non-text files and introduced informative skip messages for ignored files or binary content.
Updated the query parameter for the Git badge in the README.md from `gitea-url` to `gitea_url` to fix a broken link. This ensures the badge correctly displays the last commit status by properly constructing the URL with the appropriate query parameter. This change enhances the project documentation's accuracy and reliability by ensuring all external links perform as expected.
Introduced a comprehensive setup for `hostsd`, a simple hosts file manager, marking the project's inception. This entails crafting the PyPI CI/CD pipeline configuration, ensuring seamless publication processes on tag-based releases. Additionally, standard project necessities such as `.gitignore`, `LICENSE`, and `README.md` were put in place, alongside the core project configuration in `pyproject.toml`. The initial source code foundation is laid out in `src/hostsd`, featuring argument parsing and file management logic essential for hosts file manipulation.
The PyPI CI/CD configuration in `.forgejo/workflows/pypi.yml` facilitates automated publishing to PyPI upon tagging, backed by Docker to guarantee environment consistency. The project adopts a community-friendly stance with an MIT license, encouraging open collaboration. Documentation is immediately available via `README.md`, covering installation, usage, and automated update setups, ensuring users can effectively leverage `hostsd` from the get-go.
This setup underscores the project's commitment to enabling efficient hosts file management across various environments, laying the groundwork for future enhancements and community contributions.