1 # various completions for tld-ftp-admin tools
2 # Author: Elan Ruusamäe <glen@pld-linux.org>
4 # return list of pld ftp trees
7 if [ -z "$PFA_TREES" ]; then
16 PFA_TREES=${PFA_TREES# }
19 COMPREPLY=( $( compgen -W "$PFA_TREES" -- "$cur" ) )
22 # return list of files in a tree
24 local tree="$1" cur="$2" file i
25 local dir=~/ftp/$tree/SRPMS/.metadata
27 # generate reply from dir
28 COMPREPLY=( $( compgen -f -X "*.(src.rpm.info)" -- "$dir/$cur" ) )
29 # filter out dirname from results
30 for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do
31 file=${COMPREPLY[$i]##*/}
42 _get_comp_words_by_ref cur
44 if [[ "$cur" == -* ]]; then
45 COMPREPLY=( $( compgen -W '\
47 --nopoldek --noyum --norpmrepo \
48 --poldek --yum --rpmrepo \
55 complete -F _pfa-genindex pfa-genindex
63 _get_comp_words_by_ref cur
65 if [[ "$cur" == -* ]]; then
66 COMPREPLY=( $( compgen -W '-q -s --quiet' -- "$cur" ) )
68 # The first argument is an tree; the rest are files in a dir
71 if [[ $args == 1 ]]; then
75 _pfa_tree_files "$arg" "$cur"
79 complete -F _pfa-lintpkg pfa-lintpkg
87 _get_comp_words_by_ref cur
89 # The first argument is an tree; the rest are files in a dir
92 if [[ $args == 1 ]]; then
95 _pfa_tree_files "${COMP_WORDS[1]}" "$cur"
98 complete -F _pfa-signpkg pfa-signpkg pfa-rmpkg
106 _get_comp_words_by_ref cur
108 # The first two arguments are tree names; the rest are files in a dir
111 if [[ $args == 1 ]] || [[ $args == 2 ]]; then
114 _pfa_tree_files "${COMP_WORDS[1]}" "$cur"
117 complete -F _pfa-mvpkg pfa-mvpkg pfa-testmvpkg
122 # sh-indent-comment: t
123 # indent-tabs-mode: nil
125 # ex: ts=4 sw=4 et filetype=sh