fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

Johannes AltmanningerMark private functions that don't need localizationa53db7256

master
939 B17 linesraw
1# localization: skip(private)
2#
3# This function is compatible with clang, clang++, and variations thereof, and is shared
4# by clang.fish and clang++.fish.
5# We dynamically query the head at `(commandline -x)[1]` to get the correct completions.
6function __fish_complete_clang
7    # If the result is for a value, clang only prints the value, so completions
8    # for `-std=` print `c++11` and not `-std=c++11` like we need. See #4174.
9    set -l prefix (commandline -ct | string replace -fr -- '^(.*=)[^=]*' '$1')
10
11    # Don't hard-code the name of the clang binary
12    set -l clang (commandline -xp)[1]
13    # first get the completions from clang, with the prefix separated from the value by a comma
14    $clang --autocomplete=(commandline -ct | string unescape | string replace -- "$prefix" "$prefix,") 2>/dev/null |
15        # and put it in a format that fish understands
16        string replace -r -- '^([^ ]+)\s*(.*)' "$prefix\$1\t\$2"
17end