fork/fish-shell

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

Ilan CosmanRun fish_indent on all non-test .fish files566a673e4

master
8.3 KiB131 linesraw
1complete -c ping -xa "(__fish_print_hostnames)"
2
3set -l ping_version (ping -V 2>&1 | string collect)
4
5switch $ping_version
6    case '*iputils*'
7        # completions for ping from iputils
8        complete -c ping -s 4 -d "Use IPv4"
9        complete -c ping -s 6 -d "Use IPv6"
10        complete -c ping -s a -d "Audible ping"
11        complete -c ping -s A -d "Adaptive ping"
12        complete -c ping -s b -d "Allow pinging a broadcast address (IPv4 only)"
13        complete -c ping -s B -d "Sticky source address"
14        complete -c ping -s c -d "Stop after specified number of packets" -x
15        complete -c ping -s D -d "Print timestamps"
16        complete -c ping -s d -d "Set SO_DEBUG socket option"
17        complete -c ping -s f -d "Flood ping"
18        complete -c ping -s F -d "Define flow label (IPv6 only)" -x
19        complete -c ping -s h -d "Print help and exit"
20        complete -c ping -s I -d "Set source address to specified interface address" -xa "(__fish_print_interfaces; __fish_print_addresses)"
21        complete -c ping -s i -d "Seconds between sending each packet" -x
22        complete -c ping -s L -d "Suppress loopback of multicast packets"
23        complete -c ping -s l -d "Send the specified number of packets without waiting for reply" -x
24        complete -c ping -s m -d "Tag the packets going out" -x
25        complete -c ping -s M -d "Select Path MTU Discovery strategy" -xa "do want dont"
26        complete -c ping -s n -d "No dns name resolution"
27        complete -c ping -s N -d "Send ICMPv6 Node Information Queries (IPv6 only)" -x
28        complete -c ping -s O -d "Report outstanding replies"
29        complete -c ping -s p -d "Contents of padding byte" -x
30        complete -c ping -s R -d "Record route (IPv4 only)"
31        complete -c ping -s q -d "Quiet mode"
32        complete -c ping -s Q -d "Set QoS bits in ICMP datagrams" -x
33        complete -c ping -s s -d "Number of data bytes to be sent" -x
34        complete -c ping -s S -d "Set socket buffer size" -x
35        complete -c ping -s t -d "Set the IP Time to Live" -x
36        complete -c ping -s T -d "Set IP timestamp options (IPv4 only)" -xa "tsonly tsandaddr tsprespec"
37        complete -c ping -s U -d "Print full user-to-user latency"
38        complete -c ping -s v -d "Verbose mode"
39        complete -c ping -s V -d "Display version and exit"
40        complete -c ping -s w -d "Specify a timeout, in seconds, before ping exits" -x
41        complete -c ping -s W -d "Time to wait for a response, in seconds" -x
42
43    case '*inetutils*'
44        # completions for ping from GNU inetutils
45        complete -c ping -l address -l mask -d "Send ICMP_ADDRESS packets"
46        complete -c ping -l echo -d "Send ICMP_ECHO packets"
47        complete -c ping -l timestamp -d "Send ICMP_TIMESTAMP packets"
48        complete -c ping -s t -l type -d "Set packet type" -x
49        complete -c ping -s c -l count -d "Set number of packets to send" -x
50        complete -c ping -s d -l debug -d "Set the SO_DEBUG option"
51        complete -c ping -s i -l interval -d "Set seconds to wait between sending each packet" -x
52        complete -c ping -s n -l numeric -d "Do not resolve host addresses"
53        complete -c ping -s r -l ignore-routing -d "Send directly to a host on an attached network"
54        complete -c ping -l ttl -d "Set time-to-live" -x
55        complete -c ping -s T -l tos -d "Set type of service" -x
56        complete -c ping -s v -l verbose -d "Verbose output"
57        complete -c ping -s w -l timeout -d "Stop after N seconds" -x
58        complete -c ping -s W -l linger -d "Number of seconds to wait for response" -x
59        complete -c ping -s f -l flood -d "Flood ping"
60        complete -c ping -l ip-timestamp -d "Set IP timestamp type" -xa "tsonly tsaddr"
61        complete -c ping -s l -l preload -d "Send number of packets as fast as possible" -x
62        complete -c ping -s p -l pattern -d "Fill ICMP packet with given pattern" -x
63        complete -c ping -s q -l quiet -d "Quiet output"
64        complete -c ping -s R -l route -d "Record route"
65        complete -c ping -s s -l size -d "Set number of data octets" -x
66        complete -c ping -s \? -l help -d "Show help"
67        complete -c ping -l usage -d "Short usage message"
68        complete -c ping -s V -l version -d "Print program version"
69
70    case '*BusyBox*'
71        # completions for ping from busybox
72        complete -c ping -s 4 -d "Use IPv4"
73        complete -c ping -s 6 -d "Use IPv6"
74        complete -c ping -s c -d "Set number of pings to send" -x
75        complete -c ping -s s -d "Set data size" -x
76        complete -c ping -s i -d "Interval (seconds)" -x
77        complete -c ping -s A -d "Ping as soon as reply is received"
78        complete -c ping -s t -d "Set TTL" -x
79        complete -c ping -s I -d "Source interface or IP address" -xa "(__fish_print_interfaces; __fish_print_addresses)"
80        complete -c ping -s W -d "Seconds to wait for the first response" -x
81        complete -c ping -s w -d "Seconds until ping exits" -x
82        complete -c ping -s q -d Quiet
83        complete -c ping -s p -d "Payload pattern" -x
84
85    case '*'
86        set -l ping_os_version (uname)
87        switch $ping_os_version
88            case '*FreeBSD*' '*Darwin*'
89                # In common with FreeBSD and Apple
90                complete -c ping -s A -d "Audible ping"
91                complete -c ping -s a -d "Audible ping"
92                complete -c ping -s C -d "Prohibit the socket from using the cellular network interface"
93                complete -c ping -s c -d "Stop after specified number of packets" -x
94                complete -c ping -s D -d "Set the Don't Fragment bit"
95                complete -c ping -s d -d "Set the SO_DEBUG socket option"
96                complete -c ping -s f -d "Flood ping"
97                complete -c ping -s G -d "Maximum payload size for sweeping pings" -x
98                complete -c ping -s g -d "Minimum payload size for sweeping pings" -x
99                complete -c ping -s h -d "Payload size increment for sweeping pings" -x
100                complete -c ping -s I -d "Source multicast packets with the given interface address" -x
101                complete -c ping -s i -d "Seconds between sending each packet" -x
102                complete -c ping -s L -d "Suppress loopback of multicast packets"
103                complete -c ping -s l -d "Send specified number of packets as fast as possible" -x
104                complete -c ping -s M -d "Use ICMP_MASKREQ or ICMP_TSTAMP instead of ICMP_ECHO" -xa "mask time"
105                complete -c ping -s m -d "Time To Live for outgoing packets" -x
106                complete -c ping -s n -d "Numeric output only"
107                complete -c ping -s o -d "Exit successfully after receiving one reply packet"
108                complete -c ping -s P -d "Specify IPsec policy for the ping session" -x
109                complete -c ping -s p -d "Pattern to fill the sent packets" -x
110                complete -c ping -s Q -d "Somewhat quiet output"
111                complete -c ping -s q -d "Quiet output"
112                complete -c ping -s R -d "Record route"
113                complete -c ping -s r -d "Bypass the normal routing tables"
114                complete -c ping -s S -d "Source address for outgoing packets" -xa "(__fish_print_addresses)"
115                complete -c ping -s s -d "The number of data bytes to be sent" -x
116                complete -c ping -s T -d "Time To Live for multicasted packets" -x
117                complete -c ping -s t -d "Timeout (seconds) before ping exits" -x
118                complete -c ping -s v -d "Verbose output"
119                complete -c ping -s W -d "Time (milliseconds) to wait for a reply for each packet sent" -x
120                complete -c ping -s z -d "Use the specified type of service" -x
121
122                if string match -q '*Darwin*' $ping_os_version
123                    # Apple specific
124                    complete -c ping -s b -d "Bind the socket to specified interface for sending" -xa "(__fish_print_interfaces)"
125                    complete -c ping -s k -d "Traffic class to use for sending ICMP packets" -xa "BK_SYS BK BE RD OAM AV RV VI VO CTL"
126                    complete -c ping -s K -d "Network service type to use for sending ICMP packets" -xa "BK_SYS BK BE RV AV RD OAM VI SIG VO"
127                    complete -c ping -l apple-connect -d "Connects the socket to the destination address"
128                    complete -c ping -l apple-time -d "Prints the time a packet was received"
129                end
130        end
131end