feat: Add extractor cli choice

Can only choose pdf for the time being, but allows additional
extractors to be added in the future.
This commit is contained in:
Marty Oehme 2024-01-23 08:58:32 +01:00
parent 3b4db7b6b8
commit f477deea7c
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A
2 changed files with 22 additions and 5 deletions

View file

@ -50,6 +50,18 @@ papis.config.register_default_settings(DEFAULT_OPTIONS)
),
help="Choose an output template to format annotations with.",
)
@click.option(
"--extractor",
"-e",
"extractors",
type=click.Choice(
list(extractor.extractors.keys()),
case_sensitive=False,
),
default=list(extractor.extractors.keys()),
multiple=True,
help="Choose an extractor to apply to the selected documents.",
)
@click.option(
"--force/--no-force",
"-f",
@ -64,6 +76,7 @@ def main(
doc_folder: str,
manual: bool,
write: bool,
extractors: str,
template: str,
git: bool,
force: bool,
@ -86,6 +99,7 @@ def main(
logger.warning(papis.strings.no_documents_retrieved_message)
return
print(extractors)
formatter = formatters.get(template)
run(documents, edit=manual, write=write, git=git, formatter=formatter, force=force)