summaryrefslogtreecommitdiff
path: root/completions/e2fsprogs
blob: 50ce7885bbac9e363dc1defe478768930a0a60fd (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
171
172
173
174
175
176
177
178
179
180
# bash completion for e2fsprogs

have badblocks &&
_badblocks()
{
    COMPREPLY=()
    local cur prev
    _get_comp_words_by_ref cur prev

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

    if [[ "$cur" == -* ]]; then
        # -w (dangerous) and -X (internal use) not here on purpose
        COMPREPLY=( $( compgen -W '-b -c -e -d -f -i -n -o -p -s -t -v' \
            -- "$cur" ) )
        return 0
    fi

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


have dumpe2fs &&
_dumpe2fs()
{
    COMPREPLY=()
    local cur prev
    _get_comp_words_by_ref cur prev

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

    if [[ "$cur" == -* ]]; then
        COMPREPLY=( $( compgen -W '-b -o -f -h -i -x -V' -- "$cur" ) )
        return 0
    fi

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


have e2freefrag &&
_e2freefrag()
{
    COMPREPLY=()
    local cur prev
    _get_comp_words_by_ref cur prev

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

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

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


have e2label &&
_e2label()
{
    COMPREPLY=()
    local cur cword
    _get_comp_words_by_ref cur cword

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


have filefrag &&
_filefrag()
{
    COMPREPLY=()
    local cur
    _get_comp_words_by_ref cur

    if [[ "$cur" == -* ]]; then
        COMPREPLY=( $( compgen -W '-B -b -s -v -x' -- "$cur" ) )
        return 0
    fi

    _filedir
} &&
complete -F _filefrag filefrag


have tune2fs &&
_tune2fs()
{
    COMPREPLY=()
    local cur prev
    _get_comp_words_by_ref cur prev

    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 '-c -C -e -E -f -g -i -j -J -l -L -m -M -o
            -O -r -T -u -U' -- "$cur" ) )
    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