File: bashcompletion

package info (click to toggle)
alfa 2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 17,796 kB
  • sloc: f90: 3,426; makefile: 83
file content (41 lines) | stat: -rwxr-xr-x 1,987 bytes parent folder | download | duplicates (2)
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
# alfa(1) completion
# rw@nebulousresearch.org

_alfa()
{
    local cur prev opts words cword format_options
    _init_completion || return
    COMPREPLY=()

    cur="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"
    opts="-n --normalise -vg --velocity-guess -rg --resolution-guess -vtol1 --velocity-tolerance-1 -vtol2 --velocity-tolerance-2 -rtol1 --resolution-tolerance-1 -rtol2 --resolution-tolerance-2 -ss --subtract-sky -o --output-dir --sky-catalogue --strong-catalogue --deep-catalogue -skyc -sc -dc -g --generations -ps --populationsize -pr --pressure -b --bad-data -ul --upper-limits --citation -ws --wavelength-scaling --collapse -el --exclude-line -dl --detection-limit -rb --rebin -nc --no-continuum -cw --continuum-window -wc --wavelength-column -fc --flux-column -of --output-format -cl --clobber"

    if [[ "$cur" == -* ]]; then
        COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
    fi

    case "${prev}" in
        --sky-catalogue|--strong-catalogue|--deep-catalogue|-skyc|-sc|-dc)
            COMPREPLY=( $(compgen -W "$(/bin/ls /usr/share/alfa/)" -- $cur) )
            _filedir
            return 0
            ;;
        -o|--output-dir)
            _filedir -d
            return 0
            ;;
        -of|--output-format)
            format_options="text fits csv latex"
            COMPREPLY=( $( compgen -W "$format_options" -- "$cur" ) )
            return 0
            ;;
        --pressure|-g|-ps|--generations|--resolution-guess|-n|--resolution-tolerance-1|--velocity-guess|--normalise|--resolution-tolerance-2|--velocity-tolerance-1|-rg|--velocity-tolerance-2|-rtol1|-vg|--populationsize|-rtol2|-vtol1|-pr|-vtol2|-b|--bad-data|-ws|--wavelength-scaling|-el|--exclude-line|-dl|--detection-limit|-rb|--rebin|-nc|--no-continuum|-cw|--continuum-window|-wc|--wavelength-column|-fc|--flux-column)
            COMPREPLY=()
            return 0
            ;;
    esac

    _filedir '@(fit?(s)|ascii|dat|txt)'
}
complete -F _alfa alfa