#file-content #clipboard #file #relative-path #file-path #aggregation #cli-file

app file_aggregator

File Aggregator is a utility for aggregating and distributing file contents. It allows you to combine file contents from a specified directory into a single text, which is copied to the clipboard. You can also distribute file contents from the clipboard back to their respective files based on the relative paths.

2 unstable releases

0.2.0 Jul 24, 2024
0.1.0 Jul 23, 2024

#234 in Filesystem

32 downloads per month

MIT license

23KB
396 lines

Test dependency status License: MIT Crates.io Download

File Aggregator

File Aggregator is a utility for aggregating and distributing file contents. It allows you to combine file contents from a specified directory into a single text, which is copied to the clipboard. You can also distribute file contents from the clipboard back to their respective files based on the relative paths.

Features

  • Aggregate File Contents: Combine the contents of multiple files from a specified directory into a single text.
  • Distribute File Contents: Distribute the contents from the clipboard back into their respective files based on relative paths.
  • Clipboard Integration: Copy the aggregated contents directly to the clipboard for easy sharing.
  • Path and Extension Filtering: Specify the root path and file extensions to include or exclude certain files.
  • Delete File Contents: Remove files whose paths are specified in the clipboard with a specific identifier.

Planned Features

  • Enhanced Error Handling:
    • Improve error messages and handling using crates like thiserror or anyhow.
  • Logging:
    • Add logging capabilities using a crate like log or env_logger to provide more insight into the tool's operations, especially for debugging and user feedback.
  • Parallel Processing:
    • Implement parallel processing for file operations using the rayon crate to improve performance.
  • Verbose and Quiet Modes:
    • Provide options for verbose output (detailed logs) and quiet mode (minimal output) to give users control over the output verbosity.
  • Configuration File Support:
    • Allow users to specify configurations in a file (e.g., JSON, TOML) instead of only through command-line arguments.

Installation

  1. Clone the repository:

    git clone https://github.com/bornacvitanic/file_aggregator.git
    cd file_aggregator
    
  2. Build the project:

    cargo build --release
    

Usage

fileagg [COMMAND]

Commands

  • aggregate: Aggregates file contents.
  • distribute: Distributes file contents.
  • help: Print this message or the help of the given subcommand(s).

Options

  • -p, --path <PATH>: The path to use for the operation. If not specified, defaults to the current directory.
  • -e, --extensions <EXTENSIONS>: A comma-separated list of file extensions to include. If not specified, all files are included.

Examples

  1. Aggregate file contents:

    fileagg aggregate --path "/path/to/directory" --extensions "rs,txt,md"
    
  2. Distribute file contents:

    fileagg distribute --path "/path/to/directory"
    

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgements

  • clap - Library for command-line interface (CLI) parsing
  • walkdir - Library for recursive directory traversal
  • copypasta - Library for clipboard access

Contact

Dependencies

~1.2–8.5MB
~69K SLoC