Skip to content
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

feat(cli): Add --filename-template and --max-length options #763

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

Conversation

AdamQuadmon
Copy link

Introduces two new CLI arguments to allow fine-grained control over how output file paths are generated:

--filename-template: Specify a template string using variables like {domain}, {hash}, {ext} to define a custom directory structure and file naming scheme

--max-length: Set a maximum character limit for generated file paths, intelligently truncating if needed while preserving essential components

Includes documentation and tests.

Closes #754

Introduces two new CLI arguments to allow fine-grained control over how output file paths are generated:

--filename-template: Specify a template string using variables like {domain}, {hash}, {ext} to define a custom directory structure and file naming scheme

--max-length: Set a maximum character limit for generated file paths, intelligently truncating if needed while preserving essential components

Includes documentation updates covering the new options, examples, and troubleshooting.

Closes adbar#754
@DesBw
Copy link

DesBw commented Dec 8, 2024

That will be great. I am looking forward for this feature to make it to this incredible tool.

tests/filename_tests.py Dismissed Show dismissed Hide dismissed
tests/filename_tests.py Dismissed Show dismissed Hide dismissed
tests/filename_tests.py Dismissed Show dismissed Hide dismissed
tests/filename_tests.py Dismissed Show dismissed Hide dismissed
Copy link

codecov bot commented Dec 9, 2024

Codecov Report

Attention: Patch coverage is 94.11765% with 10 lines in your changes missing coverage. Please review.

Project coverage is 99.03%. Comparing base (76200b7) to head (c44c7b5).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
trafilatura/filename.py 93.24% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #763      +/-   ##
==========================================
- Coverage   99.26%   99.03%   -0.24%     
==========================================
  Files          21       22       +1     
  Lines        3559     3728     +169     
==========================================
+ Hits         3533     3692     +159     
- Misses         26       36      +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@adbar
Copy link
Owner

adbar commented Dec 9, 2024

@AdamQuadmon Thanks for the substantial PR, it's great that you included tests and documentation. Could you please make sure the tests pass for older Python versions? I don't think the code security warning are important.

@adbar
Copy link
Owner

adbar commented Dec 9, 2024

Please also improve test coverage.

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.

CLI: better control of output file names
3 participants