From 9847e1ff46ef05c04d89ceb8b711841f8aa7cf00 Mon Sep 17 00:00:00 2001 From: Aleksey Bykhun Date: Wed, 30 Oct 2024 04:40:05 -0700 Subject: [PATCH] Accept input directory as first parameter, default to . Related to #7 --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/kirill-markin/repo-to-text/issues/7?shareId=XXXX-XXXX-XXXX-XXXX). --- README.md | 6 ++++++ repo_to_text/main.py | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 988ad7d..da534f9 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,12 @@ You can customize the behavior of `repo-to-text` with the following options: repo-to-text --debug > debug_log.txt 2>&1 ``` +- `input_dir`: Specify the directory to process. If not provided, the current directory (`.`) will be used. For example: + + ```bash + repo-to-text /path/to/input_dir + ``` + ## Settings `repo-to-text` also supports configuration via a `.repo-to-text-settings.yaml` file. By default, the tool works without this file, but you can use it to customize what gets included in the final text file. diff --git a/repo_to_text/main.py b/repo_to_text/main.py index 3f11179..9f1d0a7 100644 --- a/repo_to_text/main.py +++ b/repo_to_text/main.py @@ -254,6 +254,7 @@ def create_default_settings_file(): def main(): parser = argparse.ArgumentParser(description='Convert repository structure and contents to text') + parser.add_argument('input_dir', nargs='?', default='.', help='Directory to process') # P3e87 parser.add_argument('--debug', action='store_true', help='Enable debug logging') parser.add_argument('--output-dir', type=str, help='Directory to save the output file') parser.add_argument('--create-settings', action='store_true', help='Create default .repo-to-text-settings.yaml file') # Новый аргумент @@ -266,7 +267,7 @@ def main(): create_default_settings_file() logging.debug('.repo-to-text-settings.yaml file created') else: - save_repo_to_text(output_dir=args.output_dir) + save_repo_to_text(path=args.input_dir, output_dir=args.output_dir) # Pf5b7 logging.debug('repo-to-text script finished')