Skip to content

Add -x option for custom output #58

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Jython1415
Copy link

This PR adds --execute (or -x) to run a specified command on the file and use the output instead of just reading the file.

My initial motivation was because I wanted to have a token limit (like with ttok -t) to be applied to each file, but after trying to bake that behavior into files-to-prompt I realized it would be simpler and more extensible to have files-to-prompt provide the --execute as the interface for further customization.

Here are some examples of how it could be used. I'm sure there's a bunch I'm not creative enough to think of at the moment.

# token-based limit
files-to-prompt . --execute "ttok -t 100 -i"
# line-based limit
files-to-prompt . --execute "head -n 10"

This doesn't change the default behavior, and I added new tests for the behavior with --execute.

Would love to hear feedback. If this isn't in-scope that's alright too. I just think it would be a good way to enable a lot of behavior that would otherwise be out-of-scope (e.g. #37 could be addressed with a script that does special behavior on .ipynb files).

@Jython1415 Jython1415 changed the title Added -x option for custom output Add -x option for custom output Apr 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant