summaryrefslogtreecommitdiffstats
path: root/gen/completions/_sd
blob: 1a8c1501cd67889d15a77524d83598b839118c2b (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
#compdef sd

autoload -U is-at-least

_sd() {
    typeset -A opt_args
    typeset -a _arguments_options
    local ret=1

    if is-at-least 5.2; then
        _arguments_options=(-s -S -C)
    else
        _arguments_options=(-s -C)
    fi

    local context curcontext="$curcontext" state line
    _arguments "${_arguments_options[@]}" \
'-n+[Limit the number of replacements that can occur per file. 0 indicates unlimited replacements]:LIMIT: ' \
'--max-replacements=[Limit the number of replacements that can occur per file. 0 indicates unlimited replacements]:LIMIT: ' \
'-f+[Regex flags. May be combined (like \`-f mc\`).]:FLAGS: ' \
'--flags=[Regex flags. May be combined (like \`-f mc\`).]:FLAGS: ' \
'-p[Display changes in a human reviewable format (the specifics of the format are likely to change in the future)]' \
'--preview[Display changes in a human reviewable format (the specifics of the format are likely to change in the future)]' \
'-F[Treat FIND and REPLACE_WITH args as literal strings]' \
'--fixed-strings[Treat FIND and REPLACE_WITH args as literal strings]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'-V[Print version]' \
'--version[Print version]' \
':find -- The regexp or string (if using `-F`) to search for:' \
':replace_with -- What to replace each match with. Unless in string mode, you may use captured values like $1, $2, etc:' \
'*::files -- The path to file(s). This is optional - sd can also read from STDIN:_files' \
&& ret=0
}

(( $+functions[_sd_commands] )) ||
_sd_commands() {
    local commands; commands=()
    _describe -t commands 'sd commands' commands "$@"
}

if [ "$funcstack[1]" = "_sd" ]; then
    _sd "$@"
else
    compdef _sd sd
fi