File: udisks-bash-completion.sh

package info (click to toggle)
udisks 1.0.4-7wheezy1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 5,672 kB
  • sloc: ansic: 26,949; sh: 11,094; xml: 8,654; python: 1,162; makefile: 442
file content (38 lines) | stat: -rw-r--r-- 2,315 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

# Check for bash
[ -z "$BASH_VERSION" ] && return

####################################################################################################

__udisks() {
    local IFS=$'\n'
    local cur="${COMP_WORDS[COMP_CWORD]}"

    if [ "${COMP_WORDS[$(($COMP_CWORD - 1))]}" = "--show-info" ] ; then
        COMPREPLY=($(compgen -W "$(udisks --enumerate-device-files)" -- $cur))
    elif [ "${COMP_WORDS[$(($COMP_CWORD - 1))]}" = "--inhibit-polling" ] ; then
        COMPREPLY=($(compgen -W "$(udisks --enumerate-device-files)" -- $cur))
    elif [ "${COMP_WORDS[$(($COMP_CWORD - 1))]}" = "--mount" ] ; then
        COMPREPLY=($(compgen -W "$(udisks --enumerate-device-files)" -- $cur))
    elif [ "${COMP_WORDS[$(($COMP_CWORD - 1))]}" = "--unmount" ] ; then
        COMPREPLY=($(compgen -W "$(udisks --enumerate-device-files)" -- $cur))
    elif [ "${COMP_WORDS[$(($COMP_CWORD - 1))]}" = "--detach" ] ; then
        COMPREPLY=($(compgen -W "$(udisks --enumerate-device-files)" -- $cur))
    elif [ "${COMP_WORDS[$(($COMP_CWORD - 1))]}" = "--eject" ] ; then
        COMPREPLY=($(compgen -W "$(udisks --enumerate-device-files)" -- $cur))
    elif [ "${COMP_WORDS[$(($COMP_CWORD - 1))]}" = "--ata-smart-refresh" ] ; then
        COMPREPLY=($(compgen -W "$(udisks --enumerate-device-files)" -- $cur))
    elif [ "${COMP_WORDS[$(($COMP_CWORD - 1))]}" = "--ata-smart-simulate" ] ; then
        _filedir || return 0
    elif [ "${COMP_WORDS[$(($COMP_CWORD - 1))]}" = "--set-spindown" ] ; then
        COMPREPLY=($(compgen -W "$(udisks --enumerate-device-files)" -- $cur))
    elif [ "${COMP_WORDS[$(($COMP_CWORD - 1))]}" = "--poll-for-media" ] ; then
        COMPREPLY=($(compgen -W "$(udisks --enumerate-device-files)" -- $cur))
    else
        COMPREPLY=($(IFS=: compgen -W "--dump:--inhibit-polling:--inhibit-all-polling:--enumerate:--enumerate-device-files:--monitor:--monitor-detail:--show-info:--help:--mount:--mount-fstype:--mount-options:--unmount:--unmount-options:--detach:--detach-options:--eject:--eject-options:--ata-smart-refresh:--ata-smart-wakeup:--ata-smart-simulate:--set-spindown:--set-spindown-all:--spindown-timeout:--poll-for-media" -- $cur))
    fi
}

####################################################################################################

complete -o filenames -F __udisks udisks