Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/process file utility #107

Conversation

MEHRSHAD-MIRSHEKARY
Copy link
Collaborator

  • Added setup_directories:

    • This utility function ensures that both the log directory and the required subdirectory exist before proceeding.
    • Automatically creates a 'pretty' subdirectory where reformatted files will be saved.
    • Raises FileNotFoundError if the log or subdirectory does not exist, improving error handling for file processing commands.
  • Added process_files:

    • A generator function that iterates over files in a specified directory, filtering by a given file extension (e.g., .json or .xml).
    • It applies a handler function to each file, enabling reusability for multiple file types.
    • Yields both the file path and filename for easy file management in other parts of the system.
  • Improved Code Structure:

    • Centralized common file processing logic to reduce duplication in 'generate pretty JSON' and 'generate pretty XML' management commands.
    • Enhanced directory and file handling, ensuring safer file manipulation across different formats.

…tories in pretty JSON and XML commands

- **Added setup_directories:**
  - This utility function ensures that both the log directory and the required subdirectory exist before proceeding.
  - Automatically creates a 'pretty' subdirectory where reformatted files will be saved.
  - Raises FileNotFoundError if the log or subdirectory does not exist, improving error handling for file processing commands.

- **Added process_files:**
  - A generator function that iterates over files in a specified directory, filtering by a given file extension (e.g., .json or .xml).
  - It applies a handler function to each file, enabling reusability for multiple file types.
  - Yields both the file path and filename for easy file management in other parts of the system.

- **Improved Code Structure:**
  - Centralized common file processing logic to reduce duplication in 'generate pretty JSON' and 'generate pretty XML' management commands.
  - Enhanced directory and file handling, ensuring safer file manipulation across different formats.
Copy link
Collaborator

@ARYAN-NIKNEZHAD ARYAN-NIKNEZHAD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved 👌

@ARYAN-NIKNEZHAD ARYAN-NIKNEZHAD merged commit 126aaa8 into Lazarus-org:main Oct 4, 2024
5 checks passed
@MEHRSHAD-MIRSHEKARY MEHRSHAD-MIRSHEKARY deleted the feat/process-file-utility branch October 11, 2024 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants