summaryrefslogtreecommitdiff
path: root/completions/e2fsprogs
blob: 1f5753be387fd042003d9d351f1a2093d5f84d3a (plain)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# bash completion for e2fsprogs

_badblocks()
{
    local cur prev words cword
    _init_completion || return

    case $prev in
        -b|-c|-e|-d|-p|-t)
            return 0
            ;;
        -i|-o)
            _filedir
            return 0
            ;;
    esac

    if [[ "$cur" == -* ]]; then
        COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) )
        # Filter out -w (dangerous) and -X (internal use)
        for i in ${!COMPREPLY[@]}; do
            [[ ${COMPREPLY[i]} == -[wX] ]] && unset COMPREPLY[i]
        done
        return 0
    fi

    cur=${cur:=/dev/}
    _filedir
} &&
complete -F _badblocks badblocks


_dumpe2fs()
{
    local cur prev words cword
    _init_completion || return

    case $prev in
        -o|-V)
            return 0
            ;;
        -i)
            _filedir
            return 0
            ;;
    esac

    if [[ "$cur" == -* ]]; then
        COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) )
        return 0
    fi

    cur=${cur:=/dev/}
    _filedir
} &&
complete -F _dumpe2fs dumpe2fs


_e2freefrag()
{
    local cur prev words cword
    _init_completion || return

    case $prev in
        -c|-h)
            return 0
            ;;
    esac

    if [[ "$cur" == -* ]]; then
        COMPREPLY=( $( compgen -W '$( _parse_usage "$1" -h )' -- "$cur" ) )
        return 0
    fi

    cur=${cur:=/dev/}
    _filedir
} &&
complete -F _e2freefrag e2freefrag


_e2label()
{
    local cur prev words cword
    _init_completion || return

    if [ $cword -eq 1 ]; then
        cur=${cur:=/dev/}
        _filedir
    fi
} &&
complete -F _e2label e2label


_filefrag()
{
    local cur prev words cword
    _init_completion || return

    if [[ "$cur" == -* ]]; then
        COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) )
        return 0
    fi

    _filedir
} &&
complete -F _filefrag filefrag


_tune2fs()
{
    local cur prev words cword
    _init_completion || return

    case $prev in
        -c|-C|-E|-i|-J|-L|-m|-r|-T)
            return 0
            ;;
        -e)
            COMPREPLY=( $( compgen -W 'continue remount-ro panic' -- "$cur" ) )
            return 0
            ;;
        -g)
            _gids
            COMPREPLY=( $( compgen -g -W '${COMPREPLY[@]}' -- "$cur" ) )
            return 0
            ;;
        -M)
            _filedir -d
            ;;
        -o)
            local -a opts=(^debug ^bsdgroups ^user_xattr ^acl ^uid16
                ^journal_data ^journal_data_ordered ^journal_data_writeback)
            COMPREPLY=( $( compgen -W '${opts[@]} ${opts[@]#^}' -- "$cur" ) )
            return 0
            ;;
        -O)
            local -a opts=(^dir_index ^dir_nlink ^extent ^extra_isize ^filetype
                ^flex_bg ^has_journal ^huge_file ^large_file ^resize_inode
                ^sparse_super ^uninit_bg)
            COMPREPLY=( $( compgen -W '${opts[@]} ${opts[@]#^}' -- "$cur" ) )
            return 0
            ;;
        -u)
            _uids
            COMPREPLY=( $( compgen -u -W '${COMPREPLY[@]}' -- "$cur" ) )
            return 0
            ;;
        -U)
            COMPREPLY=( $( compgen -W 'clear random time' -- "$cur" ) )
            return 0
            ;;
    esac

    if [[ "$cur" == -* ]]; then
        COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) )
        return
    fi

    cur=${cur:=/dev/}
    _filedir
} &&
complete -F _tune2fs tune2fs

# Local variables:
# mode: shell-script
# sh-basic-offset: 4
# sh-indent-comment: t
# indent-tabs-mode: nil
# End:
# ex: ts=4 sw=4 et filetype=sh