"Fossies" - the Fresh Open Source Software Archive

Member "Buku-4.2.2/auto-completion/bash/buku-completion.bash" (2 May 2019, 1630 Bytes) of package /linux/privat/Buku-4.2.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "buku-completion.bash": 4.0_vs_4.1.

    1 #
    2 # Bash completion definition for Buku.
    3 #
    4 # Author:
    5 #   Arun Prakash Jana <engineerarun@gmail.com>
    6 #
    7 
    8 _buku () {
    9     COMPREPLY=()
   10     local IFS=$' \n'
   11     local cur=$2 prev=$3
   12     local -a opts opts_with_args
   13     opts=(
   14         -a --add
   15         --ai
   16         -c --comment
   17         --cached
   18         --colors
   19         -d --delete
   20         --deep
   21         -e --export
   22         --expand
   23         -f --format
   24         -h --help
   25         -i --import
   26         --immutable
   27         -j --json
   28         -k --unlock
   29         -l --lock
   30         -n --count
   31         --nc
   32         --np
   33         -o --open
   34         --oa
   35         -p --print
   36         -r --sreg
   37         --replace
   38         -s --sany
   39         -S --sall
   40         --shorten
   41         --suggest
   42         -t --stag
   43         --tacit
   44         --tag
   45         --threads
   46         --title
   47         -u --update
   48         --url
   49         -V
   50         -v --version
   51         -w --write
   52         -x --exclude
   53         -z --debug
   54     )
   55     opts_with_arg=(
   56         -a --add
   57         --cached
   58         --colors
   59         -e --export
   60         --expand
   61         -f --format
   62         -i --import
   63         --immutable
   64         -n --count
   65         -r --sreg
   66         --replace
   67         -s --sany
   68         -S --sall
   69         --shorten
   70         --threads
   71         --url
   72         -x --exclude
   73     )
   74 
   75     # Do not complete non option names
   76     [[ $cur == -* ]] || return 1
   77 
   78     # Do not complete when the previous arg is an option expecting an argument
   79     for opt in "${opts_with_arg[@]}"; do
   80         [[ $opt == $prev ]] && return 1
   81     done
   82 
   83     # Complete option names
   84     COMPREPLY=( $(compgen -W "${opts[*]}" -- "$cur") )
   85     return 0
   86 }
   87 
   88 complete -F _buku buku