#compdef smartocr

_arguments \
    '1:image or PDF:_files' \
    '(-l --lang)'{-l,--lang}'[OCR language code or auto]:language:($(smartocr --list-languages | cut -d " " -f 1) auto)' \
    '--list-languages[list supported language codes]' \
    '(-o --output)'{-o,--output}'[write output to a file]:output file:_files' \
    '--format[output format]:format:(text json)' \
    '--json-diagnostics[emit diagnostics as JSON lines]' \
    '--searchable-pdf[write a searchable PDF]:output PDF:_files' \
    '--copy[copy text to the clipboard]' \
    '--preprocess[enhance contrast and sharpness]' \
    '--deskew[correct text skew]' \
    '--threshold[apply automatic thresholding]' \
    '--rotate[rotate input clockwise]:degrees:(0 90 180 270)' \
    '--scale[resize input before OCR]:scale:' \
    '--cpu[force CPU inference]' \
    '--debug[show debug information]' \
    '--show-info[show final OCR information]' \
    '--no-cleanup[disable punctuation cleanup]' \
    '--version[show version]' \
    '(-h --help)'{-h,--help}'[show help]'
