-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcompletion.sh
More file actions
30 lines (26 loc) · 743 Bytes
/
completion.sh
File metadata and controls
30 lines (26 loc) · 743 Bytes
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
_develo_completion() {
local cur files
# Get the current word being completed
if [ -n "$BASH_VERSION" ]; then
cur="${COMP_WORDS[COMP_CWORD]}"
elif [ -n "$ZSH_VERSION" ]; then
cur="${words[CURRENT]}"
fi
# Generate the list of files in .develo directory
files=($(for file in .develo/*; do
basename "$file"
done))
if [ -n "$BASH_VERSION" ]; then
# Bash-specific completion
COMPREPLY=( $(compgen -W "${files[*]}" -- "${cur}") )
elif [ -n "$ZSH_VERSION" ]; then
# Zsh-specific completion
compadd "${files[@]}"
fi
}
# Register the completion function
if [ -n "$BASH_VERSION" ]; then
complete -F _develo_completion develo
elif [ -n "$ZSH_VERSION" ]; then
compdef _develo_completion develo
fi