summaryrefslogtreecommitdiffstats
path: root/gen/completions/sd.elv
blob: 3aaa7fbee61a362d2dee863e329f3b6977a88e95 (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'
            cand -f 'Regex flags. May be combined (like `-f mc`).'
            cand --flags 'Regex flags. May be combined (like `-f mc`).'
            cand -p 'Output result into stdout and do not modify files'
            cand --preview 'Output result into stdout and do not modify files'
            cand -F 'Treat FIND and REPLACE_WITH args as literal strings'
            cand --fixed-strings 'Treat FIND and REPLACE_WITH args as literal strings'
            cand -r 'Recursively replace files'
            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]
}