blob: 825b5c54d79d9f03f142b081bfbde5c58dc784c1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# Complete filenames for td(1)
_td() {
local dir
dir=${TODO_DIR:-$HOME/Todo}
while IFS= read -d '' -r fn ; do
COMPREPLY[${#COMPREPLY[@]}]=$fn
done < <(
shopt -s extglob nullglob
shopt -u dotglob
declare -a fns
cd -- "$dir" || exit
fns=(*)
((${#fns[@]})) || exit
printf '%s\0' "${fns[@]##$dir/}"
)
return
}
complete -F _td td
|