mirror of
https://github.com/sharkdp/bat.git
synced 2024-11-23 00:03:27 +01:00
Update fish completions for new --list-languages format
This commit is contained in:
parent
493a4e719e
commit
06b8dcb7eb
22
assets/completions/bat.fish
vendored
22
assets/completions/bat.fish
vendored
@ -3,28 +3,14 @@
|
|||||||
|
|
||||||
# Helper function:
|
# Helper function:
|
||||||
function __bat_autocomplete_languages --description "A helper function used by "(status filename)
|
function __bat_autocomplete_languages --description "A helper function used by "(status filename)
|
||||||
bat --list-languages | awk '
|
bat --list-languages | awk -F':' '
|
||||||
NR == 1 {
|
|
||||||
dc = 0;
|
|
||||||
while (substr($0, dc, 2) != " ") dc++;
|
|
||||||
while (substr($0, dc, 1) == " ") dc++;
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
langField = substr($0, 0, dc - 2);
|
lang=$1
|
||||||
if (langField !~ /^ *$/) {
|
split($2, exts, ",")
|
||||||
lang = langField;
|
|
||||||
sub(/ +$/, "", lang);
|
|
||||||
}
|
|
||||||
|
|
||||||
split(substr($0, dc), exts, ",");
|
|
||||||
for (i in exts) {
|
for (i in exts) {
|
||||||
ext=exts[i]
|
ext=exts[i]
|
||||||
|
if (ext !~ /[A-Z].*/ && ext !~ /^\..*rc$/) {
|
||||||
sub(/^ +/, "", ext); # Trim leading whitespace.
|
|
||||||
sub(/ +$/, "", ext); # Trim trailing whitespace.
|
|
||||||
|
|
||||||
if ((ext != "") && (ext !~ /[A-Z].*/)) {
|
|
||||||
print ext"\t"lang
|
print ext"\t"lang
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user