aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/functions/__fish_gnu_complete.fish
blob: 3a7fa30c4e5da1356cf17a331839566f37e44e11 (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
function __fish_gnu_complete -d "Wrapper for the complete builtin. Skips the long completions on non-GNU systems"
	set is_gnu 0

	set -l argv_out

	# Check if we are using a gnu system
	for i in $argv
		switch  $i
			
			case -g --is-gnu
				set is_gnu 1

			case '*'
				 set argv_out $argv_out $i
		end
	end

	set argv $argv_out
	set argv_out

	# Remove long option if not on a gnu system
	if test $is_gnu = 0
		for i in $argv

			if set -q __fish_gnu_complete_skip_next
				set -e __fish_gnu_complete_skip_next
				continue
			end
	
			switch $i
				case -l --long
					set __fish_gnu_complete_skip_next 1
					continue
			end

			set argv_out $argv_out $i
		end
		set argv $argv_out
	end
	set -e __fish_gnu_complete_skip_next
	
	complete $argv

end