source: lliurex-maker/trunk/fuentes/new/etc/bash_completion.d/lliurex-maker @ 916

Last change on this file since 916 was 916, checked in by kbut, 5 years ago

complete bash_completion with archs

File size: 882 bytes
Line 
1have lliurex-maker &&
2_lliurex_maker()             
3{
4    local cur prev opts base
5    COMPREPLY=()
6    cur="${COMP_WORDS[COMP_CWORD]}"
7    prev="${COMP_WORDS[COMP_CWORD-1]}"
8
9    #
10    #  The basic options we'll complete.
11    #
12    opts="build clean -a --arch= -m --mirror= -i --interactive"
13
14
15    #
16    #  Complete the arguments to some of the basic commands.
17    #
18    case "${prev}" in
19        build)
20            local running=$( ls /usr/share/lliurex-maker/configuration/ | grep -v "common" | tr "\n" " ")
21            COMPREPLY=( $(compgen -W "${running}" -- ${cur}) )
22            return 0
23            ;;
24        -a|--arch)
25                local archs="i386 amd64"
26                COMPREPLY=( $(compgen -W "${archs}" -- ${cur}))
27        ;;
28        *)
29        ;;
30    esac
31
32   COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
33   return 0
34}
35[ "$have" ] && complete -F _lliurex_maker lliurex-maker
Note: See TracBrowser for help on using the repository browser.