blob: 04682edabe15994819c9e0344af052a32ee39b07 (
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
|
_website_filedir() { local IFS=$'\n' xspec _expand || return 0 local -a toks local tmp toks=( ${toks[@]-} $( compgen -d -X "$1" -- "$(quote_readline "$cur")" | { while read -r tmp; do [ -n "$tmp" ] && echo "${tmp}/" done } )) COMPREPLY=( "${COMPREPLY[@]}" "${toks[@]}" ) } _website_newdoc() { local dir='src' local excl='[._]*' if [[ "$COMP_CWORD" -gt 1 ]]; then dir="${dir}/tags" else excl="@(${excl}|tags)" fi local cur="$(_get_cword)" pushd "$dir" >/dev/null _website_filedir "$excl" popd >/dev/null } _website_newtag() { false } complete -o filenames -o nospace -F _website_newdoc ./new-doc complete -o filenames -o nospace -F _website_newtag ./new-tag
|