source: roaraudio/plugins/bash/roaraudio @ 5439:7950543cabbc

Last change on this file since 5439:7950543cabbc was 5205:f3a15f146010, checked in by phi, 12 years ago

updated bash completion file

File size: 20.2 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_roar_config() {
577    local cur prev opts libs
578    COMPREPLY=()
579    cur="${COMP_WORDS[COMP_CWORD]}"
580    prev="${COMP_WORDS[COMP_CWORD-1]}"
581    opts="--help --version --libs --cflags --output-pc --output-normal"
582    libs="roar roardsp roarmidi roarlight roareio roaresd esd roarartsc artsc roarpulse pulse roarpulse-simple pulse-simple roarsndio sndio roaryiff Y2"
583    liblibs=lib`echo "$libs" | sed 's/ / lib/g'`
584   COMPREPLY=($(compgen -W "${opts} ${libs} ${liblibs}" -- ${cur}))
585   return 0
586}
587
588complete -F _roar_config roar-config
589
590_roard()
591{
592    local cur prev opts
593    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
594    COMPREPLY=()
595    cur="${COMP_WORDS[COMP_CWORD]}"
596    prev="${COMP_WORDS[COMP_CWORD-1]}"
597
598    #
599    #  The basic options we'll complete.
600    #
601    opts_misc="--daemon --verbose --terminate --start --restart --stop --shutdown --realtime --memlock --chroot --setgid --setuid --sysclocksync --location --description --pidfile --log-syslog --script-postdown"
602    opts_auth="--guest-acclev --trust-acclev --trust-root --no-trust-root --authfile-gen --authfile-load --authfile-type --authfile-acclev --new-authfile"
603    opts_plugins="--plugin-load"
604    opts_audio="--rate --bits --chans -R -B -C --aiprofile"
605    opts_stream="--stream-flags"
606    opts_rolestack="--list-rolestack --rolestack-push"
607    opts_output="--odriver --odevice -o -O -oO -oP -oN --list-driver"
608    opts_source="--source -s -S -sO -sP -sN --list-sources"
609    opts_mixer="-m --mixer -M -mO -mN -mP --list-mixers"
610    opts_cf="--list-cf"
611    opts_midi="--midi-no-console --midi-console-enable --midi-console --ssynth-enable --ssynth-disable"
612    opts_light="--light-channels"
613    opts_rdtcs="--rds-pi --rds-ps --rds-pty --rds-tp --rds-ct"
614    opts_x11="--x11-display --display"
615    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"
616
617    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"
618
619
620    #
621    #  Complete the arguments to some of the basic commands.
622    #
623    case "${prev}" in
624# DIR/FILE:
625        '--chroot')
626            _filedir -d
627            return 0
628            ;;
629        '--pidfile')
630            _filedir
631            return 0
632            ;;
633        '--script-postdown')
634            _filedir
635            return 0
636            ;;
637        '--plugin-load')
638            _filedir
639            return 0
640            ;;
641        '--authfile-gen'|'--authfile-load')
642            _filedir
643            return 0
644            ;;
645# MemLock:
646        '--memlock')
647            COMPREPLY=($(compgen -W "none low medium high nearlyall nearlyallsys allcur all default" -- ${cur})) 
648            return 0
649            ;;
650# Acclev
651        '--guest-acclev'|'--trust-acclev'|'--authfile-acclev')
652            COMPREPLY=($(compgen -W "none idented conctl guest user pwruser all" -- ${cur})) 
653            return 0
654            ;;
655        '--authfile-type')
656            COMPREPLY=($(compgen -W "roar esd pulse htpasswd xauth" -- ${cur})) 
657            return 0
658            ;;
659# String:
660        '--location'|'--description')
661            return 0
662            ;;
663# Int:
664        '--rate'|'-R'|'--proto-rate')
665            _roar_rate
666            return 0
667            ;;
668        '--bits'|'-B'|'--proto-bits')
669            _roar_bits
670            return 0
671            ;;
672        '--chans'|'-C'|'--proto-chans')
673            _roar_channels
674            return 0
675            ;;
676        '--light-channels')
677            COMPREPLY=($(compgen -W "512 1024 1536 2048 4096 8192" -- ${cur})) 
678            return 0
679            ;;
680        '--jumbo-mtu')
681            _roar_jumbo_mtu
682            return 0
683            ;;
684# C=F:
685        '--stream-flags')
686            return 0
687            ;;
688# R:A
689        '--rolestack-push')
690            return 0
691            ;;
692# driver:
693        '--odriver'|'-o')
694            words=$(roard --list-driver | tail -n +3 | sed 's/^ *//; s/ .*$//')
695            COMPREPLY=($(compgen -W "${words}" -- ${cur})) 
696            return 0
697            ;;
698# Source:
699        '--source'|'-s')
700            words=$(roard --list-sources | tail -n +3 | sed 's/^ *//; s/ .*$//')
701            COMPREPLY=($(compgen -W "${words}" -- ${cur})) 
702            return 0
703            ;;
704# Device:
705# FIXME: add support for non file devices
706        '--odevice'|'-O')
707            _filedir
708            return 0
709            ;;
710        '-S')
711            _filedir
712            return 0
713            ;;
714        '--midi-console')
715            _filedir
716            return 0
717            ;;
718# Options:
719        '-dO')
720            return 0
721            ;;
722        '-oO')
723            return 0
724            ;;
725        '-sO')
726            return 0
727            ;;
728# RDS:
729        '--rds-pi')
730            return 0
731            ;;
732        '--rds-ps')
733            return 0
734            ;;
735        '--rds-pty')
736            return 0
737            ;;
738# Mixer:
739#    opts_mixer="-m --mixer -M -mO -mN -mP --list-mixers"
740        '--mixer'|'-m')
741            words=$(roard --list-mixers | tail -n +3 | sed 's/^ *//; s/ .*$//')
742            COMPREPLY=($(compgen -W "${words}" -- ${cur}))
743            return 0
744            ;;
745        '-M')
746            _filedir
747            return 0
748            ;;
749        '-mO')
750            return 0
751            ;;
752        '-mN')
753            return 0
754            ;;
755        '-mP')
756            return 0
757            ;;
758        '--list-mixers')
759            return 0
760            ;;
761# X11:
762        '--x11-display'|'--display')
763            return 0
764            ;;
765# Port:
766        '--port'|'-p')
767            COMPREPLY=( $( compgen -s $cur ) )
768            return 0
769            ;;
770# Host/Node/File:
771        '--bind'|'-b')
772            COMPREPLY=( $( compgen -A hostname $cur ) "0.0.0.0" )
773            return 0
774            ;;
775        '--sock')
776            _filedir
777            return 0
778            ;;
779# Proto:
780        '--proto')
781            words=$(roard --list-proto | tail -n +3 | sed 's/^ *//; s/ .*$//')
782            COMPREPLY=($(compgen -W "${words}" -- ${cur})) 
783            return 0
784            ;;
785        '--proto-profile')
786            words=$(roard --list-profiles | tail -n +3 | sed 's/^ *//; s/ .*$//')
787            COMPREPLY=($(compgen -W "${words}" -- ${cur}))
788            return 0
789            ;;
790        '--proto-aiprofile'|'--aiprofile')
791            words=$(roarctl --list-aiprofiles | grep '^Profile Name' | sed 's/^.*: *//')
792            COMPREPLY=($(compgen -W "${words}" -- ${cur}))
793            return 0
794            ;;
795# FH:
796        '--client-fh')
797            words=$(command ls /proc/self/fd 2> /dev/null)
798            COMPREPLY=($(compgen -W "${words}" -- ${cur})) 
799            return 0
800            ;;
801        '--close-fh')
802            words=$(command ls /proc/self/fd 2> /dev/null)
803            COMPREPLY=($(compgen -W "${words}" -- ${cur})) 
804            return 0
805            ;;
806# Dir:
807        '--proto-dir')
808            _roar_dir
809            return 0;
810            ;;
811# Codec:
812        '--proto-codec')
813            _roar_codec
814            return 0;
815            ;;
816
817        *)
818        ;;
819    esac
820
821   COMPREPLY=($(compgen -W "${opts}" -- ${cur})) 
822   return 0
823}
824complete -F _roard roard
825
826complete -F _command roarify
827
828# vim:ft=sh:
829
830#ll
Note: See TracBrowser for help on using the repository browser.