blob: 3644e8573891ff9f76247c7a655b1d68da0c97aa (
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
# This file is generated by [bash-completor](https://github.com/adoyle-h/bash-completor/tree/v0.2.0). Do not modify it manually.
#
# [Usage]
# Put "source aur-completion.bash" in your bashrc.
#
# If you want to debug the completion.
# Search '# Uncomment this line for debug' line in this file.
#
# [Update Script]
# bash-completor -c aur.completor.bash
# shellcheck disable=2207
# editorconfig-checker-disable
_aur_comp_cmd_opts=( -h --help -l --list -f --force -g --git -c --config )
_aur_comp_reply_aur_pkgs ()
{
pkgs=$(basename -a ~/.aur/*/ | paste -d ' ' -s -);
COMPREPLY=("$(compgen -W "$pkgs" -- "$cur")")
}
_aur_comp_reply_dirs ()
{
local IFS=$'\n';
compopt -o nospace -o filenames;
COMPREPLY=($(compgen -A directory -- "$cur"))
}
_aur_comp_reply_files ()
{
local IFS=$'\n';
compopt -o nospace -o filenames;
COMPREPLY=($(compgen -A file -- "$cur"))
}
_aur_comp_reply_files_in_pattern ()
{
compopt -o nospace -o filenames;
local path;
while read -r path; do
if [[ $path =~ $1 ]] || [[ -d $path ]]; then
COMPREPLY+=("$path");
fi;
done < <(compgen -A file -- "$cur")
}
_aur_comp_reply_list ()
{
local IFS=', ';
local array_list="" array_name;
for array_name in "$@";
do
array_list="$array_list \${${array_name}[*]}";
done;
array_list="${array_list[*]:1}";
IFS=$'\n'' ';
eval "COMPREPLY=( \$(compgen -W \"$array_list\" -- \"\$cur\") )"
}
_aur_comp_reply_words ()
{
local IFS=$'\n';
COMPREPLY=($(IFS=', ' compgen -W "$*" -- "${cur#=}"))
}
_aur_comp_reply_set() {
local IFS=', '
local array_list="" array_name
# shellcheck disable=2068
for array_name in $@; do
array_list="$array_list \${_aur_comp_var_${array_name}[*]}"
done
array_list="${array_list[*]:1}"
IFS=$'\n'' '
eval "COMPREPLY=( \$(compgen -W \"$array_list\" -- \"\$cur\") )"
}
_aur_completions() {
COMPREPLY=()
local cur=${COMP_WORDS[COMP_CWORD]}
local prev=${COMP_WORDS[COMP_CWORD-1]}
# Uncomment this line for debug
# echo "[COMP_CWORD:$COMP_CWORD][cur:$cur][prev:$prev][WORD_COUNT:${#COMP_WORDS[*]}][COMP_WORDS:${COMP_WORDS[*]}]" >> bash-debug.log
# Enter the cmd completion
if [[ ${cur:0:1} == [-+] ]]; then
# rely options of command
_aur_comp_reply_list _aur_comp_cmd_opts
elif [[ ${prev:0:1} == [-+] ]]; then
case "${prev}" in
# rely the value of command option
-c) _aur_comp_reply_files ;;
--config) _aur_comp_reply_files ;;
*) _aur_comp_reply_aur_pkgs ;;
esac
else
# rely the argument of command
_aur_comp_reply_aur_pkgs
fi
}
complete -F _aur_completions -o bashdefault aur
# vi: sw=2 ts=2
|