blob: 1459c73724ffea316637d07804014f6f90f3295b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
#compdef say
local ret=1
local -a context line state state_descr tmp
local -A opt_args val_args
_arguments -s -S : \
'(-a --audio-device)'{-a+,--audio-device=}'[specify audio device]: :->devices' \
'--bit-rate=[specify bit rate]: :->bit-rates' \
'--channels=[specify number of channels]:number of channels' \
'--data-format=[specify output data format]: :->data-formats' \
'(: -f --input-file)'{-f+,--input-file=}'[specify input file]:input file:_files' \
'--file-format=[specify output file format]: :->file-formats' \
'(-i --interactive)-i[display/highlight text as it is spoken]' \
'(-i --interactive)--interactive=[display/highlight text as it is spoken]:: :->markups' \
'(-o --output-file)'{-o+,--output-file=}'[specify output file]:output file:_files' \
'(-n --network-send)'{-n+,--network-send=}'[specify network service/port]:network service/port' \
'--progress[display progress meter]' \
'--quality=[specify converter quality level]:quality level (0-127)' \
'(-r --rate)'{-r+,--rate=}'[specify speech rate]:speech rate (words per minute)' \
'(-v --voice)'{-v+,--voice=}'[specify voice]: :->voices' \
'(-f)*: :_guard "^-*" "text to speak"' \
&& ret=0
case $state in
bit-rates)
# A file format must have already been provided in order to complete these;
# also, not every file format supports bit-rate values
(( $+opt_args[--file-format] )) && {
tmp=( ${(f)"$(
_call_program bit-rates $words[1] \
--file-format=${opt_args[--file-format]##*:} \
--bit-rate='\?'
)"} )
tmp=( ${tmp//[[:space:]]##/} )
}
if (( $#tmp )); then
_values 'bit rate' $tmp && ret=0
else
_message 'bit rate' && ret=0
fi
;;
data-formats)
# A file format must have already been provided in order to complete these
if (( ! $+opt_args[--file-format] )); then
_message 'data format' && ret=0
else
tmp=( ${(f)"$(
_call_program data-formats $words[1] \
--file-format=${opt_args[--file-format]##*:} \
--data-format='\?'
)"} )
tmp=( ${tmp//:/\\:} )
tmp=( ${^tmp/[[:space:]]##/[}\] )
_values 'data format' $tmp && ret=0
fi
;;
devices)
tmp=( ${(f)"$( _call_program devices $words[1] -a '\?' )"} )
tmp=( ${tmp##[[:space:]]#[0-9]##[[:space:]]##} )
tmp=( ${tmp//:/\\:} )
_values 'audio device name or ID' $tmp && ret=0
;;
file-formats)
tmp=( ${(f)"$( _call_program file-formats $words[1] --file-format='\?' )"} )
tmp=( ${tmp%%[[:space:]]##\(.*} )
tmp=( ${tmp//:/\\:} )
tmp=( ${^tmp/[[:space:]]##/[}\] )
_values 'file format' $tmp && ret=0
;;
markups)
tmp=( bold smso smul ${(k)terminfo} )
_alternative \
'colors:color:(black red green yellow blue magenta cyan white)' \
"capabilities:terminfo capability:( ${(j< >)tmp} )" \
&& ret=0
;;
voices)
tmp=( ${(f)"$( _call_program voices $words[1] -v '\?' )"} )
tmp=( ${tmp%%[[:space:]](#c2,)*} )
_values voice $tmp && ret=0
;;
esac
return ret
|