Repository navigation
fix(cli): make ocr --output name the one requested format, or refuse several - #79
Merged
Merged
Conversation
…several `ocr --format pdf --output out.pdf` wrote the searchable PDF beside the source and then the bare transcript to out.pdf: a text file with a .pdf name that looked like it had worked. With one format requested -- through --format or the bare --pdf flag -- --output now names that format's file, written by that format's writer through the new outputs.write_to; with several there is no single file to name, so the combination is refused with a message before the OCR runs. Without --format, --output still writes the bare transcript as it always has. Closes #25 Co-authored-by: Yvette Mankerian <yvettekm@gmail.com> Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Deploying tetrak with
|
| Latest commit: |
57d8724
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://a83fb1f9.tetrak.pages.dev |
| Branch Preview URL: | https://fix-ocr-output-with-format.tetrak.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #25.
tetrak-ocr ocr page.png --format pdf --output out.pdfwrote the searchable PDF beside the source aspage.pdfand then the bare transcript toout.pdf, a text file with a.pdfname that looked like it had worked.--formator the bare--pdfflag,--outputnow names that format's file, written by that format's writer.--format pdf --output out.pdfwrites a real PDF atout.pdfand nothing beside the source;--format text --output t.txtwrites the text format there.--format,--outputstill writes the bare transcript exactly as before, so existing scripts are unchanged.--pdf PATHis untouched and remains the other way to name a PDF.outputs.write_to(name, source, transcript, destination)is the one addition: a writer for a chosen path, with no stem rule and no collision guard;outputs.writenow goes through it.Tests: five new CLI cases (one format to the named file as a real PDF, the text writer rather than the bare transcript, the bare
--pdfflag, several formats refused before the backend runs,--outputalone unchanged) and one forwrite_to. Fast suite: 425 passed; ruff, Sphinx-Wand markdownlint clean.🤖 Generated with Claude Code