mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-12-05 02:47:00 +08:00
6a28cce96b
* Remove whitespace (blanks, tabs, cr) at line endings Signed-off-by: Stefan Weil <sw@weilnetz.de>
40 lines
785 B
Bash
40 lines
785 B
Bash
#-*- mode: shell-script;-*-
|
|
#
|
|
# bash completion support for tesseract
|
|
#
|
|
# Copyright (C) 2009 Neskie A. Manuel <neskiem@gmail.com>
|
|
# Distributed under the Apache License, Version 2.0.
|
|
#
|
|
|
|
_tesseract_languages()
|
|
{
|
|
local TESSDATA="/usr/share/tesseract-ocr/tessdata/"
|
|
local langs="$(ls $TESSDATA | grep traineddata | cut -d \. -f 1)"
|
|
|
|
COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W "$langs" -- "$cur") )
|
|
}
|
|
|
|
_tesseract()
|
|
{
|
|
local cur prev
|
|
COMPREPLY=()
|
|
cur="$2"
|
|
prev="$3"
|
|
|
|
case "$prev" in
|
|
tesseract)
|
|
COMPREPLY=($(compgen -f -X "!*.+(tif)" -- "$cur") )
|
|
;;
|
|
*.tif)
|
|
COMPREPLY=($(compgen -W "$(basename $prev .tif)" ) )
|
|
;;
|
|
-l)
|
|
_tesseract_languages
|
|
;;
|
|
*)
|
|
COMPREPLY=($(compgen -W "-l" ) )
|
|
;;
|
|
esac
|
|
}
|
|
complete -F _tesseract -o nospace tesseract
|