source: roaraudio/plugins/bash/roaraudio @ 5875:9714028b09ba

Last change on this file since 5875:9714028b09ba was 5875:9714028b09ba, checked in by phi, 11 years ago

update roar-config infos

File size: 20.6 KB
Line 
1#
2#  /etc/bash_completion.d/roaraudio
3#
4# Bash completion function for the RoarAudio.
5# http://roaraudio.keep-cool.org/
6#
7# Philipp "ph3-der-loewe" Schafft <lion@lion.leolix.org>
8# --
9#
10
11# Tools supported completly:
12#roard
13#roar-config
14
15# Tools supported partly:
16#roarctl (volume not implemented correctly)
17
18# Tools not supported at all:
19
20# Tools not supported at all and unimportent:
21
22# Unsupported devel tools:
23#roartypes
24
25# The rest:
26#roarcat
27#roarcatplay
28#roarcatvio
29#roarbidir
30#roarmon
31#roarmonhttp
32#roarradio
33#roarlight
34#roarinterconnect
35#roarclientpass
36#roarfilt
37#roarvumeter
38#roarsockconnect
39#roarphone
40#roarshout
41#roarvorbis
42#roarsin
43#roardtmf
44#roarvio
45
46_roar_no_opts() {
47    COMPREPLY=()
48}
49complete -F _roar_no_opts roarsocktypes roartypes
50
51_roar_server() {
52    COMPREPLY=( $(_roar_server_exec "$1") )
53}
54
55_roar_server_exec() {
56 local cur link words nodes stdsocks x11sock file_based file_based_ok
57 local addr
58 cur="$1"
59 link=$(readlink /etc/roarserver 2> /dev/null)
60
61 nodes=$(grep '^\(node\|executor\)' /etc/decnet.conf 2> /dev/null | sed 's/^.*\tname\t\t*//; s/\t.*$//; s/$/::/')
62
63 file_based="/tmp/roar $HOME/.roar /tmp/muroard"
64 stdsocks="localhost ::roar";
65
66 x11sock=$(xprop -root 2>/dev/null | grep '^ROAR_SERVER(STRING) = ' | sed 's/^[^"]*"//; s/"$//')
67
68 file_based_ok=""
69 for addr in $file_based
70 do
71  if [ -S "$addr" ]
72  then
73   file_based_ok="$file_based_ok $addr"
74  fi
75 done
76
77 words="$ROAR_SERVER $link $nodes $file_based_ok $stdsocks $x11sock +slp +fork +abstract"
78
79 compgen -A hostname $cur
80 compgen -W "$words" $cur
81}
82
83_roar_jumbo_mtu() {
84    COMPREPLY=($(compgen -W "750 1000 1100 1200 1300" -- "${COMP_WORDS[COMP_CWORD]}")) 
85}
86
87_roar_rate() {
88    local cur
89    cur="${COMP_WORDS[COMP_CWORD]}"
90    COMPREPLY=($(compgen -W "8000 16000 32000 11025 22050 44100 48000 96000" -- ${cur})) 
91}
92
93_roar_bits() {
94    local cur
95    cur="${COMP_WORDS[COMP_CWORD]}"
96    COMPREPLY=($(compgen -W "8 16 24 32" -- ${cur})) 
97}
98
99_roar_channels() {
100    local cur
101    cur="${COMP_WORDS[COMP_CWORD]}"
102    COMPREPLY=($(compgen -W "1 2 3 4 5 6 7 8 9" -- ${cur})) 
103}
104
105_roar_codec() {
106    local cur
107    cur="${COMP_WORDS[COMP_CWORD]}"
108    words=$(roard --list-cf | tail -n +4 | sed 's/^ *//; s/ .*$//')
109    COMPREPLY=($(compgen -W "${words} default pcm" -- ${cur})) 
110}
111
112_roar_flag() {
113    local cur
114    cur="${COMP_WORDS[COMP_CWORD]}"
115    COMPREPLY=($(compgen -W "meta primary sync cleanmeta hwmixer pause mute mmap antiecho recsource passmixer virtual prethru immutable enhance singlesink" -- ${cur}))
116}
117
118_roar_dir() {
119    local cur
120    cur="${COMP_WORDS[COMP_CWORD]}"
121    COMPREPLY=($(compgen -W "play record monitor filter output mixing meta bidir thru bridge midi_in midi_out light_in light_out raw_in raw_out complex_in complex_out rdtcs_in rdtcs_out" -- ${cur}))
122}
123
124_roar_metatype() {
125    local cur
126    cur="${COMP_WORDS[COMP_CWORD]}"
127#phi@ph7:roaraudio $ echo $(grep '^#define ROAR_META_TYPE_' include/roaraudio/meta.h  | cut -d_ -f4,5,6,7,8,9 | cut -d' ' -f1 | tr A-Z a-z)
128    COMPREPLY=($(compgen -W "none title album author autor artist version date license tracknumber organization description genre location contact streamurl homepage thumbnail length comment other filename fileurl server duration www woaf encoder encodedby year discid rpg_track_peak rpg_track_gain rpg_album_peak rpg_album_gain hash signalinfo audioinfo offset performer copyright likeness composer rights isrc language gtin isbn ean publisher discnumber sourcemedia label labelno" -- ${cur}))
129}
130
131_roar_role() {
132    local cur
133    cur="${COMP_WORDS[COMP_CWORD]}"
134    COMPREPLY=($(compgen -W "unknown none music video game event beep phone background_music voice instrument rhythm click mixed" -- ${cur}))
135}
136
137_roar_baseopts() {
138    case "$1" in
139        '--rate')
140            _roar_rate
141            return 0
142            ;;
143        '--bits')
144            _roar_bits
145            return 0
146            ;;
147        '--chans')
148            _roar_channels
149            return 0
150            ;;
151        '--server')
152            _roar_server "${COMP_WORDS[COMP_CWORD]}"
153            return 0
154            ;;
155        *)
156        ;;
157    esac
158
159  return 77
160}
161
162_roar_basecodec() {
163    case "$1" in
164        '--codec')
165            _roar_codec
166            return 0
167            ;;
168        *)
169        ;;
170    esac
171
172  return 77
173}
174
175
176_roar_baseclients() {
177    local cur prev opts dirs
178    COMPREPLY=()
179    cur="${COMP_WORDS[COMP_CWORD]}"
180    prev="${COMP_WORDS[COMP_CWORD-1]}"
181
182    dirs="--wave --midi --light --raw --complex --rdtcs"
183    opts="$dirs --server --rate -R --bits -B --chans -C --codec --rel-id --help"
184
185    [ "${COMP_WORDS[0]}" = "roarmon" ] && opts="$opts --prethru"
186
187    _roar_baseopts  "$prev" && return 0;
188    _roar_basecodec "$prev" && return 0;
189
190    case "${prev}" in
191        '-R')
192            _roar_rate
193            return 0
194            ;;
195        '-B')
196            _roar_bits
197            return 0
198            ;;
199        '-C')
200            _roar_channels
201            return 0
202            ;;
203        *)
204        ;;
205    esac
206
207   _filedir
208   COMPREPLY=(${COMPREPLY[*]} $(compgen -W "${opts}" -- ${cur}))
209   return 0
210}
211complete -F _roar_baseclients roarcat roarmon
212
213_roarcatplay() {
214    local cur prev opts
215    COMPREPLY=()
216    cur="${COMP_WORDS[COMP_CWORD]}"
217
218    opts="--server --simple --passive --background --verbose --help"
219
220    case "${COMP_WORDS[COMP_CWORD-1]}" in
221        '--server')
222            _roar_server "$cur"
223            return 0
224            ;;
225        *)
226        ;;
227    esac
228
229   _filedir
230   COMPREPLY=(${COMPREPLY[*]} $(compgen -W "${opts}" -- ${cur}))
231   return 0
232}
233complete -F _roarcatplay roarcatplay
234
235_roarvumeter() {
236    local cur prev opts
237    COMPREPLY=()
238    cur="${COMP_WORDS[COMP_CWORD]}"
239    prev="${COMP_WORDS[COMP_CWORD-1]}"
240
241    opts="--server --rate --bits --chans --samples --pc --db --beat --lowpass --help"
242
243    _roar_baseopts "$prev" && return 0;
244
245    case "${prev}" in
246        '--samples')
247            COMPREPLY=($(compgen -W "5000 50000" -- ${cur})) 
248            return 0
249            ;;
250        '--lowpass')
251            COMPREPLY=($(compgen -W "100 200 300 400 500" -- ${cur})) 
252            return 0
253            ;;
254        *)
255        ;;
256    esac
257
258   COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
259   return 0
260}
261complete -F _roarvumeter roarvumeter
262
263_roarradio() {
264    local cur prev opts
265    COMPREPLY=()
266    cur="${COMP_WORDS[COMP_CWORD]}"
267    prev="${COMP_WORDS[COMP_CWORD-1]}"
268
269    opts="--server --rate --bits --chans --codec --help"
270
271    _roar_baseopts  "$prev" && return 0;
272    _roar_basecodec "$prev" && return 0;
273
274   COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
275   return 0
276}
277complete -F _roarradio roarradio
278
279_roarvorbis() {
280    local cur prev opts
281    COMPREPLY=()
282    cur="${COMP_WORDS[COMP_CWORD]}"
283    prev="${COMP_WORDS[COMP_CWORD-1]}"
284
285    opts="--server --vclt-out --help"
286
287    case "${prev}" in
288        '--vclt-out')
289            _filedir
290            return 0
291            ;;
292        '--server')
293            _roar_server "$cur"
294            return 0
295            ;;
296        *)
297        ;;
298    esac
299
300   COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
301   return 0
302}
303complete -F _roarvorbis roarvorbis
304
305
306_roarinterconnect() {
307    local cur prev opts
308    COMPREPLY=()
309    cur="${COMP_WORDS[COMP_CWORD]}"
310    prev="${COMP_WORDS[COMP_CWORD-1]}"
311
312    opts="--server --remote --type --rate --bits --chans --codec --help"
313
314    _roar_baseopts  "$prev" && return 0;
315    _roar_basecodec "$prev" && return 0;
316
317    case "${prev}" in
318        '--remote')
319            _roar_server "$cur"
320            return 0
321            ;;
322        '--type')
323            COMPREPLY=($(compgen -W "roar esd bidir filter transmit receive" -- ${cur})) 
324            return 0
325            ;;
326        *)
327        ;;
328    esac
329
330   COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
331   return 0
332}
333complete -F _roarinterconnect roarinterconnect
334
335_roarbidir() {
336    local cur prev opts
337    COMPREPLY=()
338    cur="${COMP_WORDS[COMP_CWORD]}"
339    prev="${COMP_WORDS[COMP_CWORD-1]}"
340
341    opts="--server --rate --bits --chans --codec --help"
342
343    _roar_baseopts  "$prev" && return 0;
344    _roar_basecodec "$prev" && return 0;
345
346   _filedir
347   COMPREPLY=(${COMPREPLY[*]} $(compgen -W "${opts}" -- ${cur}))
348   return 0
349}
350complete -F _roarbidir roarbidir roarcatvio roarcatpassfh roarcatsendfile
351
352_roarcatad() {
353    local cur prev opts
354    COMPREPLY=()
355    cur="${COMP_WORDS[COMP_CWORD]}"
356    prev="${COMP_WORDS[COMP_CWORD-1]}"
357
358    opts="--server --rate --bits --chans --help"
359
360    _roar_baseopts  "$prev" && return 0;
361
362   _filedir
363   COMPREPLY=(${COMPREPLY[*]} $(compgen -W "${opts}" -- ${cur}))
364   return 0
365}
366complete -F _roarcatad roarcatad roarcat2sock
367
368_roarphone() {
369    local cur prev opts mopts
370    COMPREPLY=()
371    cur="${COMP_WORDS[COMP_CWORD]}"
372    prev="${COMP_WORDS[COMP_CWORD-1]}"
373
374    mopts="--m-rn --m-nick --m-email --m-hp --m-thumbn --m-loc --m-org"
375    opts="--server --jumbo-mtu --io-flush --rate --bits --chans --afi-downmix --afi-lowpass --afi-speex-prep --afi-speex-denoise --afi-speex-agc --afi-speex-vad --codec --transcode --driver --device --antiecho --threshold --help $mopts"
376
377    _roar_baseopts  "$prev" && return 0;
378    _roar_basecodec "$prev" && return 0;
379
380    case "${prev}" in
381        '--jumbo-mtu')
382            _roar_jumbo_mtu
383            return 0
384            ;;
385        '--io-flush')
386            return 0
387            ;;
388        '--afi-lowpass')
389            return 0
390            ;;
391        '--driver')
392            return 0
393            ;;
394        '--device')
395            _filedir
396            return 0
397            ;;
398        '--antiecho')
399            COMPREPLY=($(compgen -W "none simple speex roard" -- ${cur})) 
400            return 0
401            ;;
402        '--threshold')
403            return 0
404            ;;
405        '--m-rn')
406            return 0
407            ;;
408        '--m-nick')
409            COMPREPLY=($(compgen -W "$USER" -- ${cur})) 
410            return 0
411            ;;
412        '--m-email')
413            COMPREPLY=($(compgen -W "$USER@$HOSTNAME" -- ${cur})) 
414            return 0
415            ;;
416        '--m-hp')
417            return 0
418            ;;
419        '--m-thumbn')
420            return 0
421            ;;
422        '--m-loc')
423            return 0
424            ;;
425        '--m-org')
426            return 0
427            ;;
428        *)
429        ;;
430    esac
431
432   COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
433   return 0
434}
435complete -F _roarphone roarphone
436
437_roarctl() {
438    local cur prev pprev opts cmds
439    COMPREPLY=()
440    cur="${COMP_WORDS[COMP_CWORD]}"
441    prev="${COMP_WORDS[COMP_CWORD-1]}"
442
443    pprev="--NX-COMMAND--"
444    if [ "$COMP_CWORD" -ge 2 ]
445    then
446     pprev="${COMP_WORDS[COMP_CWORD-2]}"
447    fi
448
449    if [ "$COMP_CWORD" -ge 3 ]
450    then
451     if [ "${COMP_WORDS[COMP_CWORD-3]}" = 'newvirtual' ]
452     then
453      _roar_codec
454      return 0
455     fi
456     if [ "$COMP_CWORD" -ge 4 ]
457     then
458      if [ "${COMP_WORDS[COMP_CWORD-4]}" = 'newvirtual' ]
459      then
460       _roar_rate
461       return 0
462      fi
463      if [ "$COMP_CWORD" -ge 5 ]
464      then
465       if [ "${COMP_WORDS[COMP_CWORD-5]}" = 'newvirtual' ]
466       then
467        _roar_bits
468        return 0
469       fi
470       if [ "$COMP_CWORD" -ge 6 ]
471       then
472        if [ "${COMP_WORDS[COMP_CWORD-6]}" = 'newvirtual' ]
473        then
474         _roar_channels
475         return 0
476        fi
477       fi
478      fi
479     fi
480    fi
481
482    opts="--server --help --verbose -v --list-aiprofiles --list-libstandards --enum-servers --hash-password"
483    cmds="help sleep ping whoami listaiprofiles aiprofileget standby off resume on standbymode exit terminate volume flag unflag kick newvirtual metaget metasave metaload serveroinfo listclients liststreams allinfo toogleflag protectflag role serverinfo servertime serveroinfo2 serverstandards libstandards clientinfo streaminfo"
484
485    case "${pprev}" in
486        'volume')
487            COMPREPLY=($(compgen -W "mono stereo 1 2 3 4 5 6 7 8 9" -- ${cur})) 
488            return 0
489            ;;
490        'flag'|'unflag'|'toogleflag'|'protectflag')
491            _roar_flag
492            return 0
493            ;;
494        'kick')
495            return 0
496            ;;
497        'newvirtual')
498            _roar_dir
499            return 0
500            ;;
501        'metaget')
502            _roar_metatype
503            return 0
504            ;;
505        'metasave')
506            _filedir
507            return 0
508            ;;
509        'metaload')
510            _filedir
511            return 0
512            ;;
513        'role')
514            _roar_role
515            return 0
516            ;;
517       *)
518        ;;
519    esac
520
521    case "${prev}" in
522        '--server')
523            _roar_server "$cur"
524            return 0
525            ;;
526        'sleep')
527            return 0
528            ;;
529        'ping')
530            return 0
531            ;;
532        'aiprofileget')
533            COMPREPLY=($(compgen -W "$(roarctl --list-aiprofiles | grep '^Profile Name *: *' | sed 's/^.*: *//')" -- ${cur})) 
534            return 0
535            ;;
536        'volume')
537            return 0
538            ;;
539        'flag'|'unflag'|'toogleflag'|'protectflag')
540            return 0
541            ;;
542        'kick')
543            COMPREPLY=($(compgen -W "client stream sample source" -- ${cur})) 
544            return 0
545            ;;
546        'newvirtual')
547            return 0
548            ;;
549        'metaget')
550            return 0
551            ;;
552        'metasave')
553            return 0
554            ;;
555        'metaload')
556            return 0
557            ;;
558        'serveroinfo2')
559            _roar_dir
560            return 0
561            ;;
562        'clientinfo'|'streaminfo'|'role')
563            COMPREPLY=($(compgen -W "0 1 2 3 4 5 6 7 8 9" -- ${cur})) 
564            return 0
565            ;;
566        *)
567        ;;
568    esac
569
570   COMPREPLY=($(compgen -W "${opts} ${cmds}" -- ${cur}))
571   return 0
572}
573
574complete -F _roarctl roarctl
575
576# TODO: add support to this so interactions between parameters are represented.
577_roar_config() {
578    local cur prev opts libs
579    COMPREPLY=()
580    cur="${COMP_WORDS[COMP_CWORD]}"
581    prev="${COMP_WORDS[COMP_CWORD-1]}"
582    opts="--help --version --libs --cflags --output-pc --output-normal --render-path --universal --provider --product --list-path --path --compare-versions"
583    libs="roar roardsp roarmidi roarlight roareio roaresd esd roarartsc artsc roarpulse pulse roarpulse-simple pulse-simple roarsndio sndio roaryiff Y2"
584    liblibs=lib`echo "$libs" | sed 's/ / lib/g'`
585   COMPREPLY=($(compgen -W "${opts} ${libs} ${liblibs}" -- ${cur}))
586   return 0
587}
588
589complete -F _roar_config roar-config
590
591_roard()
592{
593    local cur prev opts
594    local opts_misc opts_auth opts_plugins opts_audio opts_stream opts_rolestack opts_output opts_source opts_cf opts_midi opts_light opts_rdtcs opts_x11 opts_server
595    COMPREPLY=()
596    cur="${COMP_WORDS[COMP_CWORD]}"
597    prev="${COMP_WORDS[COMP_CWORD-1]}"
598
599    #
600    #  The basic options we'll complete.
601    #
602    opts_misc="--daemon --verbose --terminate --start --restart --stop --shutdown --realtime --memlock --chroot --setgid --setuid --sysclocksync --location --description --pidfile --log-syslog --script-postdown --watchdog --watchdog-time"
603    opts_auth="--guest-acclev --trust-acclev --trust-root --no-trust-root --authfile-gen --authfile-load --authfile-type --authfile-acclev --new-authfile"
604    opts_plugins="--plugin-load"
605    opts_audio="--rate --bits --chans -R -B -C --aiprofile"
606    opts_stream="--stream-flags"
607    opts_rolestack="--list-rolestack --rolestack-push"
608    opts_output="--odriver --odevice -o -O -oO -oP -oN --list-driver"
609    opts_source="--source -s -S -sO -sP -sN --list-sources"
610    opts_mixer="-m --mixer -M -mO -mN -mP --list-mixers"
611    opts_cf="--list-cf"
612    opts_midi="--midi-no-console --midi-console-enable --midi-console --ssynth-enable --ssynth-disable"
613    opts_light="--light-channels"
614    opts_rdtcs="--rds-pi --rds-ps --rds-pty --rds-tp --rds-ct"
615    opts_x11="--x11-display --display"
616    opts_server="--tcp --unix --decnet -t -u -n -4 -6 -64 --port -p --bind -b --sock --proto --proto-dir --proto-rate --proto-bits --proto-codec --proto-chans --list-proto --list-profiles --proto-profile --proto-aiprofile --list-aiprofiles --new-sock --slp --x11 --jumbo-mtu -G -U --no-listen --client-fh --close-fh --standby --auto-standby"
617
618    opts="$opts_misc $opts_auth $opts_plugins $opts_audio $opts_stream $opts_rolestack $opts_output $opts_source $opts_mixer $opts_cf $opts_midi $opts_light $opts_rdtcs $opts_x11 $opts_server --help"
619
620
621    #
622    #  Complete the arguments to some of the basic commands.
623    #
624    case "${prev}" in
625# DIR/FILE:
626        '--chroot')
627            _filedir -d
628            return 0
629            ;;
630        '--pidfile')
631            _filedir
632            return 0
633            ;;
634        '--script-postdown')
635            _filedir
636            return 0
637            ;;
638        '--plugin-load')
639            _filedir
640            return 0
641            ;;
642        '--authfile-gen'|'--authfile-load')
643            _filedir
644            return 0
645            ;;
646# MemLock:
647        '--memlock')
648            COMPREPLY=($(compgen -W "none low medium high nearlyall nearlyallsys allcur all default" -- ${cur})) 
649            return 0
650            ;;
651# Acclev
652        '--guest-acclev'|'--trust-acclev'|'--authfile-acclev')
653            COMPREPLY=($(compgen -W "none idented conctl guest user pwruser all" -- ${cur})) 
654            return 0
655            ;;
656        '--authfile-type')
657            COMPREPLY=($(compgen -W "roar esd pulse htpasswd xauth" -- ${cur})) 
658            return 0
659            ;;
660# String:
661        '--location'|'--description')
662            return 0
663            ;;
664# Int:
665        '--rate'|'-R'|'--proto-rate')
666            _roar_rate
667            return 0
668            ;;
669        '--bits'|'-B'|'--proto-bits')
670            _roar_bits
671            return 0
672            ;;
673        '--chans'|'-C'|'--proto-chans')
674            _roar_channels
675            return 0
676            ;;
677        '--light-channels')
678            COMPREPLY=($(compgen -W "512 1024 1536 2048 4096 8192" -- ${cur})) 
679            return 0
680            ;;
681        '--jumbo-mtu')
682            _roar_jumbo_mtu
683            return 0
684            ;;
685# C=F:
686        '--stream-flags')
687            return 0
688            ;;
689# R:A
690        '--rolestack-push')
691            return 0
692            ;;
693# driver:
694        '--odriver'|'-o')
695            words=$(roard --list-driver | tail -n +3 | sed 's/^ *//; s/ .*$//')
696            COMPREPLY=($(compgen -W "${words}" -- ${cur})) 
697            return 0
698            ;;
699# Source:
700        '--source'|'-s')
701            words=$(roard --list-sources | tail -n +3 | sed 's/^ *//; s/ .*$//')
702            COMPREPLY=($(compgen -W "${words}" -- ${cur})) 
703            return 0
704            ;;
705# Device:
706# FIXME: add support for non file devices
707        '--odevice'|'-O')
708            _filedir
709            return 0
710            ;;
711        '-S')
712            _filedir
713            return 0
714            ;;
715        '--midi-console')
716            _filedir
717            return 0
718            ;;
719# Options:
720        '-dO')
721            return 0
722            ;;
723        '-oO')
724            return 0
725            ;;
726        '-sO')
727            return 0
728            ;;
729# RDS:
730        '--rds-pi')
731            return 0
732            ;;
733        '--rds-ps')
734            return 0
735            ;;
736        '--rds-pty')
737            return 0
738            ;;
739# Mixer:
740#    opts_mixer="-m --mixer -M -mO -mN -mP --list-mixers"
741        '--mixer'|'-m')
742            words=$(roard --list-mixers | tail -n +3 | sed 's/^ *//; s/ .*$//')
743            COMPREPLY=($(compgen -W "${words}" -- ${cur}))
744            return 0
745            ;;
746        '-M')
747            _filedir
748            return 0
749            ;;
750        '-mO')
751            return 0
752            ;;
753        '-mN')
754            return 0
755            ;;
756        '-mP')
757            return 0
758            ;;
759        '--list-mixers')
760            return 0
761            ;;
762# X11:
763        '--x11-display'|'--display')
764            return 0
765            ;;
766# Port:
767        '--port'|'-p')
768            COMPREPLY=( $( compgen -s $cur ) )
769            return 0
770            ;;
771# Host/Node/File:
772        '--bind'|'-b')
773            COMPREPLY=( $( compgen -A hostname $cur ) "0.0.0.0" )
774            return 0
775            ;;
776        '--sock')
777            _filedir
778            return 0
779            ;;
780# Proto:
781        '--proto')
782            words=$(roard --list-proto | tail -n +3 | sed 's/^ *//; s/ .*$//')
783            COMPREPLY=($(compgen -W "${words}" -- ${cur})) 
784            return 0
785            ;;
786        '--proto-profile')
787            words=$(roard --list-profiles | tail -n +3 | sed 's/^ *//; s/ .*$//')
788            COMPREPLY=($(compgen -W "${words}" -- ${cur}))
789            return 0
790            ;;
791        '--proto-aiprofile'|'--aiprofile')
792            words=$(roarctl --list-aiprofiles | grep '^Profile Name' | sed 's/^.*: *//')
793            COMPREPLY=($(compgen -W "${words}" -- ${cur}))
794            return 0
795            ;;
796# FH:
797        '--client-fh')
798            words=$(command ls /proc/self/fd 2> /dev/null)
799            COMPREPLY=($(compgen -W "${words}" -- ${cur})) 
800            return 0
801            ;;
802        '--close-fh')
803            words=$(command ls /proc/self/fd 2> /dev/null)
804            COMPREPLY=($(compgen -W "${words}" -- ${cur})) 
805            return 0
806            ;;
807# Dir:
808        '--proto-dir')
809            _roar_dir
810            return 0;
811            ;;
812# Codec:
813        '--proto-codec')
814            _roar_codec
815            return 0;
816            ;;
817# Time:
818        '--watchdog-time')
819            COMPREPLY=($(compgen -W "1000 2000 3000 5000 10000 20000 25000 640000" -- ${cur}))
820            return 0;
821            ;;
822        *)
823        ;;
824    esac
825
826   COMPREPLY=($(compgen -W "${opts}" -- ${cur})) 
827   return 0
828}
829complete -F _roard roard
830
831complete -F _command roarify
832
833# vim:ft=sh:
834
835#ll
Note: See TracBrowser for help on using the repository browser.