Package: dumpwd
dumpwdOverview:dumpwdis a Python package that allows the user to dump the contents of a directory tree in a variety of formats. It can be used both as a CLI tool and as an API.Installation:You can install dumpwd using pip:pip install dumpwdCLI Usage:The CLI accepts three commands:get_inodes: This command retrieves the inodes of the directory tree rooted at the given path.Example:$ python -m dumpwd get_inodes --exclude "**/venv/**" --read --depth 2 /path/to/dirThis command will retrieve the inodes of the directory tree rooted at/path/to/dir, excluding all directories containingvenv, and reading the contents of all files. It will traverse the directory tree to a maximum depth of 2.get_tree: This command retrieves the directory tree rooted at the given path.Example:$ python -m dumpwd get_tree --exclude "**/venv/**" --read --depth 2 --compressed /path/to/dirThis command will retrieve the directory tree rooted at/path/to/dir, excluding all directories containingvenv, and reading the contents of all files. It will traverse the directory tree to a maximum depth of 2. The output will be compressed.get_contents: This command retrieves the contents of the directory tree rooted at the given path.Example:$ python -m dumpwd get_contents --exclude "**/venv/**" --read --depth 2 /path/to/dirThis command will retrieve the contents of the directory tree rooted at/path/to/dir, excluding all directories containingvenv, and reading the contents of all files. It will traverse the directory tree to a maximum depth of 2.API Usage:ThedumpwdAPI provides three functions that correspond to the three CLI commands:get_inodes(),get_tree(), andget_contents().get_inodes(path: str, exclude: Union[str, List[str]] = IGNORE_PREFIXES, read: bool = True, depth: Optional[int] = None) -> List[Tuple[str, Union[str, List[Tuple[str, Union[str, List]]]]]]: This function retrieves the inodes of the directory tree rooted at the given path.Example:fromdumpwd.apiimportget_inodesinodes=get_inodes("/path/to/dir",exclude=["**/venv/**"],read=True,depth=2)This command will retrieve the inodes of the directory tree rooted at/path/to/dir, excluding all directories containingvenv, and reading the contents of all files. It will traverse the directory tree to a maximum depth of 2.get_tree(inodes: List[Tuple[str, Union[str, List[Tuple[str, Union[str, List]]]]]], prefix: str = '', depth: Optional[int] = None, current_depth: int = 0, compressed: bool = False) -> str: This function retrieves the directory tree rooted at the given path.Example:fromdumpwd.apiimportget_inodes,get_treeinodes=get_inodes("/path/to/dir",exclude=["**/venv/**"],read=True,depth=2)tree=get_tree(inodes,prefix="",depth=None,compressed=False)This command will retrieve the directory tree rooted at/path/to/dir, excluding all directories containingvenv, and reading the contents of all files. It will traverse the directory tree to a maximum depth of 2. The output will not be compressed.get_contents(inodes: List[Tuple[str, Union[str, List[Tuple[str, bytes]]]], exclude: Union[str, List[str]] = IGNORE_PREFIXES, read: bool = True) -> List[Tuple[str, bytes]]: This function retrieves the contents of the directory tree rooted at the given path.Example:fromdumpwd.apiimportget_inodes,get_contentsinodes=get_inodes("/path/to/dir",exclude=["**/venv/**"],read=True,depth=2)contents=get_contents(inodes,exclude=["**/*.txt"],read=True)This command will retrieve the contents of the directory tree rooted at/path/to/dir, excluding all directories containingvenv, and reading the contents of all files. It will exclude all.txtfiles from the contents.ContributingContributions to this project are welcome and appreciated. To contribute, please follow these steps:Fork the project repository.Create a new branch for your feature or bug fix.Make your changes, and ensure that they work properly.Test your changes thoroughly.Submit a pull request.Please ensure that your code adheres to the coding standards of the project, and that you have added tests for any new features or changes.LicenseThis project is licensed under the MIT License. See theLICENSEfile for more information.