fork/fish-shell

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

Johannes Altmanningercompletions: don't treat token at cursor as flag6feec60a8

master
1.8 KiB57 linesraw
1set -l runtime config_cache_reload \
2    snmp_cache_reload \
3    housekeeper_execute \
4    diaginfo \
5    diaginfo= \
6    log_level_increase \
7    log_level_increase= \
8    log_level_decrease \
9    log_level_decrease=
10
11function __fish_string_in_command -a ch
12    string match -rq -- $ch (commandline)
13end
14
15function __fish_prepend -a prefix
16    set -l log_target "configuration syncer" \
17        "data sender" \
18        discoverer \
19        "history syncer" \
20        housekeeper \
21        "http poller" \
22        "icmp pinger" \
23        "ipmi manager" \
24        "ipmi poller" \
25        "java poller" \
26        poller \
27        self-monitoring \
28        "snmp trapper" \
29        "task manager" \
30        trapper \
31        "unreachable poller" \
32        "vmware collector"
33
34    if string match -rq 'log_level_(in|de)crease' $prefix
35        set var $log_target
36    else if string match -rq diaginfo $prefix
37        set var historycache preprocessing
38    end
39
40    for i in $var
41        echo $prefix="$i"
42    end
43end
44
45# General
46complete -c zabbix_proxy -s c -l config -d "Use an alternate config-file."
47complete -c zabbix_proxy -f -s f -l foreground -d "Run Zabbix agent in foreground."
48complete -c zabbix_proxy -f -s R -l runtime-control -a "$runtime" -d "Perform administrative functions."
49complete -c zabbix_proxy -f -s h -l help -d "Display this help and exit."
50complete -c zabbix_proxy -f -s V -l version -d "Output version information and exit."
51
52# Logs
53complete -c zabbix_proxy -r -f -s R -l runtime-control -n "__fish_string_in_command log_level_increase" -a "(__fish_prepend log_level_increase)"
54complete -c zabbix_proxy -r -f -s R -l runtime-control -n "__fish_string_in_command log_level_decrease" -a "(__fish_prepend log_level_decrease)"
55
56# Diag info
57complete -c zabbix_proxy -r -f -s R -l runtime-control -n "__fish_string_in_command diaginfo" -a "(__fish_prepend diaginfo)"