summaryrefslogtreecommitdiff
path: root/completions/_svn
blob: 42e2dbe79a6579755e0c2ed28323b7858e07f765 (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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# svn completion                                           -*- shell-script -*-

# Use of this file is deprecated.  Upstream completion is available in
# subversion >= 0.12.0, use that instead.

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

    local commands
    commands='add blame praise annotate ann cat checkout co cleanup commit \
                ci copy cp delete del remove rm diff di export help ? h import \
                info list ls lock log merge mkdir move mv rename ren \
                propdel pdel pd propedit pedit pe propget pget pg \
                proplist plist pl propset pset ps resolved revert \
                status stat st switch sw unlock update up'

    if [[ $cword -eq 1 ]]; then
        if [[ "$cur" == -* ]]; then
            COMPREPLY=( $(compgen -W '--version' -- "$cur") )
        else
            COMPREPLY=( $(compgen -W "$commands" -- "$cur") )
        fi
    else

        case $prev in
            --config-dir)
                _filedir -d
                return
                ;;
            -F|--file|--targets)
                _filedir
                return
                ;;
            --encoding)
                _xfunc iconv _iconv_charsets
                return
                ;;
            --editor-cmd|--diff-cmd|--diff3-cmd)
                words=(words[0] $cur)
                cword=1
                _command
                return
                ;;
        esac

        local command=${words[1]}

        if [[ "$cur" == -* ]]; then
            # possible options for the command
            local options
            case $command in
                add)
                    options='--auto-props --no-auto-props --force --targets
                        --no-ignore --non-recursive --quiet'
                    ;;
                blame|annotate|ann|praise)
                    options='--revision --username --password --no-auth-cache
                        --non-interactive --verbose --incremental --xml'
                    ;;
                cat)
                    options='--revision --username --password --no-auth-cache
                        --non-interactive'
                    ;;
                checkout|co)
                    options='--revision --quiet --non-recursive --username
                        --password --no-auth-cache --non-interactive
                        --ignore-externals'
                    ;;
                cleanup)
                    options='--diff3-cmd'
                    ;;
                commit|ci)
                    options='--message --file --encoding --force-log --quiet
                        --non-recursive --targets --editor-cmd --username
                        --password --no-auth-cache --non-interactive
                        --no-unlock'
                    ;;
                copy|cp)
                    options='--message --file --encoding --force-log --revision
                        --quiet --editor-cmd -username --password
                        --no-auth-cache --non-interactive'
                    ;;
                delete|del|remove|rm)
                    options='--force --message --file --encoding --force-log
                        --quiet --targets --editor-cmd --username
                        --password --no-auth-cache --non-interactive'
                    ;;
                diff|di)
                    options='--revision --extensions --diff-cmd
                        --no-diff-deleted --non-recursive --username
                        --password --no-auth-cache --non-interactive
                        --force --old --new --notice-ancestry'
                    ;;
                export)
                    options='--revision --quiet --username --password
                        --no-auth-cache --non-interactive --non-recursive
                        --force --native-eol --ignore-externals'
                    ;;
                import)
                    options='--auto-props --no-auto-props --message --file
                        --encoding --force-log --quiet --non-recursive
                        --no-ignore --editor-cmd --username --password
                        --no-auth-cache --non-interactive'
                    ;;
                info)
                    options='--username --password --no-auth-cache
                        --non-interactive --revision --xml --targets
                        --recursive --incremental'
                    ;;
                list|ls)
                    options='--revision --verbose --recursive --username
                        --password --no-auth-cache --non-interactive
                        --incremental --xml'
                    ;;
                lock)
                    options='--message --file --encoding --force-log --targets
                        --force --username --password --no-auth-cache
                        --non-interactive'
                    ;;
                log)
                    options='--revision --verbose --targets --username
                        --password --no-auth-cache --non-interactive
                        --stop-on-copy --incremental --xml --quiet
                        --limit'
                    ;;
                merge)
                    options='--revision --non-recursive --quiet --force
                        --dry-run --diff3-cmd --username --password
                        --no-auth-cache --non-interactive
                        --ignore-ancestry'
                    ;;
                mkdir)
                    options='--message --file --encoding --force-log --quiet
                        --editor-cmd --username --password --no-auth-cache
                        --non-interactive'
                    ;;
                move|mv|rename|ren)
                    options='--message --file --encoding --force-log --revision
                        --quiet --force --editor-cmd --username --password
                        --no-auth-cache --non-interactive'
                    ;;
                propdel|pdel|pd)
                    options='--quiet --recursive --revision --revprop
                        --username --password --no-auth-cache
                        --non-interactive'
                    ;;
                propedit|pedit|pe)
                    options='--revision --revprop --encoding --editor-cmd
                        --username --password --no-auth-cache
                        --non-interactive --force'
                    ;;
                propget|pget|pg)
                    options='--recursive --revision --revprop --strict
                        --username --password --no-auth-cache
                        --non-interactive'
                    ;;
                proplist|plist|pl)
                    options='--verbose --recursive --revision --revprop --quiet
                        --username --password --no-auth-cache
                        --non-interactive'
                    ;;
                propset|pset|ps)
                    options='--file --quiet --targets --recursive --revprop
                        --encoding --username --password --no-auth-cache
                        --non-interactive --revision --force'
                    ;;
                resolved)
                    options='--targets --recursive --quiet'
                    ;;
                revert)
                    options='--targets --recursive --quiet'
                    ;;
                status|stat|st)
                    options='--show-updates --verbose --non-recursive --quiet
                        --username --password --no-auth-cache
                        --non-interactive --no-ignore --ignore-externals
                        --incremental --xml'
                    ;;
                switch|sw)
                    options='--relocate --revision --non-recursive --quiet
                        --username --password --no-auth-cache
                        --non-interactive --diff3-cmd'
                    ;;
                unlock)
                    options='--targets --force --username --password
                        --no-auth-cache --non-interactive'
                    ;;
                update|up)
                    options='--revision --non-recursive --quiet --username
                        --password --no-auth-cache --non-interactive
                        --diff3-cmd --ignore-externals'
                    ;;
            esac
            options+=" --help --config-dir"

            COMPREPLY=( $(compgen -W "$options" -- "$cur") )
        else
            if [[ "$command" == @(help|[h?]) ]]; then
                COMPREPLY=( $(compgen -W "$commands" -- "$cur") )
            else
                _filedir
            fi
        fi
    fi

} &&
complete -F _svn svn

# ex: filetype=sh