-
Notifications
You must be signed in to change notification settings - Fork 0
/
fr_completion.bash
66 lines (61 loc) · 1.18 KB
/
fr_completion.bash
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
65
66
#/usr/bin/env bash
_fr_completions()
{
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts=(
-find-files
-find-directories
-sort-type
-depth
-reverse
-color
-threads
-inc-max-fd
-task-threshold
-exclude
-no-exclude
-fzf
-fzf-pane
-fzf-select
-fzf-search-date
-print-config
-no-config
-help
)
case "${prev}" in
-t | -?(-)sort-type)
COMPREPLY=( $(compgen -W "creation access modification size" -- "$cur") )
return 0
;;
-D | -?(-)depth | \
-T | -?(-)threads | \
-?(-)task-threshold)
return 0
;;
-e | -?(-)exclude)
_filedir
return 0
;;
-?(-)fzf-pane)
COMPREPLY=( $(compgen -W "none cat bat" -- "$cur") )
return 0
;;
-?(-)fzf-select)
COMPREPLY=( $(compgen -W "none cat bat git open" -- "$cur") )
return 0
;;
esac
if [[ "$cur" =~ ^-- ]]; then
COMPREPLY=( $(compgen -W "${opts[*]/#/-}" -- "$cur") )
return 0
elif [[ "$cur" =~ ^- ]]; then
COMPREPLY=( $(compgen -W "${opts[*]}" -- "$cur") )
return 0
fi
_filedir -d
return 0
}
complete -F _fr_completions fr