mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-01-18 06:30:14 +08:00
fix issue 247 (add bash completion)
git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@358 d0cd1f9f-072b-0410-8dd7-cf729c803f20
This commit is contained in:
parent
b3b799c87a
commit
144dcbd22c
39
tesseract.completion
Normal file
39
tesseract.completion
Normal file
@ -0,0 +1,39 @@
|
||||
#-*- 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 DangAmbigs | 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
|
Loading…
Reference in New Issue
Block a user