summaryrefslogtreecommitdiffstats
path: root/gen/completions/sd.elv
blob: d73783780deefca145fc63cbd55c714d6caa37ec (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
use builtin;
use str;

set edit:completion:arg-completer[sd] = {|@words|
    fn spaces {|n|
        builtin:repeat $n ' ' | str:join ''
    }
    fn cand {|text desc|
        edit:complex-candidate $text &display=$text' '(spaces (- 14 (wcswidth $text)))$desc
    }
    var command = 'sd'
    for word $words[1..-1] {
        if (str:has-prefix $word '-') {
            break
        }
        set command = $command';'$word
    }
    var completions = [
        &'sd'= {
            cand -n 'Limit the number of replacements that can occur per file. 0 indicates unlimited replacements'
            cand --max-replacements 'Limit the number of replacements that can occur per file. 0 indicates unlimited replacements'
            cand -f 'Regex flags. May be combined (like `-f mc`).'
            cand --flags 'Regex flags. May be combined (like `-f mc`).'
            cand -p 'Display changes in a human reviewable format (the specifics of the format are likely to change in the future)'
            cand --preview 'Display changes in a human reviewable format (the specifics of the format are likely to change in the future)'
            cand -F 'Treat FIND and REPLACE_WITH args as literal strings'
            cand --fixed-strings 'Treat FIND and REPLACE_WITH args as literal strings'
            cand -h 'Print help (see more with ''--help'')'
            cand --help 'Print help (see more with ''--help'')'
            cand -V 'Print version'
            cand --version 'Print version'
        }
    ]
    $completions[$command]
}