adsfolio.pdf.cli_common
Shared helpers for pdf CLI commands.
- adsfolio.pdf.cli_common.get_client(ctx)[source]
- Parameters:
ctx (click.core.Context)
- Return type:
- adsfolio.pdf.cli_common.handle_unresolved(pdf_path, output_dir, apply, report=True, label='unresolved')[source]
- Parameters:
pdf_path (pathlib.Path)
output_dir (pathlib.Path | None)
apply (bool)
report (bool)
label (str)
- Return type:
- adsfolio.pdf.cli_common.is_resolved_record(record)[source]
Return whether a registry record contains a successful ADS match.
- adsfolio.pdf.cli_common.iter_pdf_paths(directory, recursive)
Yield PDF files under directory, matching the suffix case-insensitively.
A symbolic link is yielded only if its target is a regular file. Symbolic links to directories are ignored and never entered, and dangling links are not yielded. Paths are not resolved.
- Parameters:
directory (Path) – Directory to scan.
recursive (bool) – Also scan subdirectories.
- Yields:
Path – Path of each PDF, built from directory.
- Raises:
OSError – If directory or any subdirectory cannot be listed, or an entry’s type cannot be determined (for example, permission denied). Callers must treat the error as an incomplete scan and must not conclude from it that unseen files are missing.
- Return type:
Notes
os.DirEntry.is_dir()andis_file()return False when the entry no longer exists, so a file removed mid-scan is silently not yielded. Other OSError values propagate.
- adsfolio.pdf.cli_common.unique_destination(output_dir, filename)[source]
- Parameters:
output_dir (pathlib.Path)
filename (str)
- Return type:
- adsfolio.pdf.cli_common.validate_author_format(_, __, value)[source]
- Parameters:
__ (click.core.Parameter)
value (str)
- Return type:
- adsfolio.pdf.cli_common.validate_char_policy(_, __, value)[source]
- Parameters:
__ (click.core.Parameter)
value (str)
- Return type: