Add pipe output feature to repo-to-text

Fixes #9

Add support for output via pipe `repo-to-text > myfile.txt`.

* Modify `save_repo_to_text` function in `repo_to_text/main.py` to write to stdout if `--stdout` is specified.
* Add `--stdout` argument to `argparse` in `repo_to_text/main.py`.
* Update `main` function in `repo_to_text/main.py` to handle the new `--stdout` argument.
* Update `README.md` to include instructions for using the new pipe output feature.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/kirill-markin/repo-to-text/issues/9?shareId=XXXX-XXXX-XXXX-XXXX).
This commit is contained in:
Aleksey Bykhun 2024-10-30 04:49:57 -07:00
parent ad36a75a7a
commit d3998786c0
2 changed files with 55 additions and 41 deletions

View file

@ -76,6 +76,14 @@ You can customize the behavior of `repo-to-text` with the following options:
repo-to-text --debug > debug_log.txt 2>&1
```
- `--stdout`: Output the generated text to stdout instead of a file. This is useful for piping the output to another command or saving it to a file using shell redirection. For example:
```bash
repo-to-text --stdout > myfile.txt
```
This will write the output directly to `myfile.txt` instead of creating a timestamped file.
## 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.