blob: 8373ee4080eb1644993911e85d64c708885e1e6b (
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
function __fish_mach_complete_no_command
for i in (commandline -opc)
if contains -- $i %(commands)s
return 1
end
end
return 0
end
function __fish_mach_complete_command_matches
for i in (commandline -opc)
if contains -- $i %(commands)s
set com $i
break
end
end
if not set -q com
return 1
end
if test "$com" != "$argv"
return 1
end
return 0
end
function __fish_mach_complete_command
__fish_mach_complete_command_matches $argv[1]
if test $status -ne 0
return 1
end
# If a subcommand is already entered, don't complete, we should defer to
# '__fish_mach_complete_subcommand'.
for i in (commandline -opc)
if contains -- $i $argv[2..-1]
return 1
end
end
return 0
end
function __fish_mach_complete_subcommand
__fish_mach_complete_command_matches $argv[1]
if test $status -ne 0
return 1
end
# Command matches, now check for subcommand
for i in (commandline -opc)
if contains -- $i $argv[2]
return 0
end
end
return 1
end
# global options
%(global_option_completions)s
# commands
%(command_completions)s
# command options
%(command_option_completions)s
|