resetting manifest requested domain to floor
[platform/upstream/createrepo.git] / createrepo.bash
1 # bash completion for createrepo and friends
2
3 _cr_createrepo()
4 {
5     COMPREPLY=()
6
7     case $3 in
8         --version|-h|--help|-u|--baseurl|--distro|--content|--repo|--workers|\
9         --revision|-x|--excludes|--changelog-limit|--max-delta-rpm-size)
10             return 0
11             ;;
12         --basedir|-c|--cachedir|--update-md-path|-o|--outputdir|\
13         --oldpackagedirs)
14             COMPREPLY=( $( compgen -d -- "$2" ) )
15             return 0
16             ;;
17         -g|--groupfile)
18             COMPREPLY=( $( compgen -f -o plusdirs -X '!*.xml' -- "$2" ) )
19             return 0
20             ;;
21         -s|--sumtype)
22             COMPREPLY=( $( compgen -W 'md5 sha1 sha256 sha512' -- "$2" ) )
23             return 0
24             ;;
25         -i|--pkglist|--read-pkgs-list)
26             COMPREPLY=( $( compgen -f -o plusdirs -- "$2" ) )
27             return 0
28             ;;
29         -n|--includepkg)
30             COMPREPLY=( $( compgen -f -o plusdirs -X '!*.rpm' -- "$2" ) )
31             return 0
32             ;;
33         --num-deltas)
34             COMPREPLY=( $( compgen -W '1 2 3 4 5 6 7 8 9' -- "$2" ) )
35             return 0
36             ;;
37     esac
38
39     if [[ $2 == -* ]] ; then
40         COMPREPLY=( $( compgen -W '--version --help --quiet --verbose --profile
41             --excludes --basedir --baseurl --groupfile --checksum --pretty
42             --cachedir --checkts --no-database --update --update-md-path
43             --skip-stat --split --pkglist --includepkg --outputdir
44             --skip-symlinks --changelog-limit --unique-md-filenames
45             --simple-md-filenames --distro --content --repo --revision --deltas
46             --oldpackagedirs --num-deltas --read-pkgs-list
47             --max-delta-rpm-size --workers' -- "$2" ) )
48     else
49         COMPREPLY=( $( compgen -d -- "$2" ) )
50     fi
51 } &&
52 complete -F _cr_createrepo -o filenames createrepo genpkgmetadata.py
53
54 _cr_mergerepo()
55 {
56     COMPREPLY=()
57
58     case $3 in
59         --version|-h|--help|-a|--archlist)
60             return 0
61             ;;
62         -r|--repo|-o|--outputdir)
63             COMPREPLY=( $( compgen -d -- "$2" ) )
64             return 0
65             ;;
66     esac
67
68     COMPREPLY=( $( compgen -W '--version --help --repo --archlist --no-database
69         --outputdir --nogroups --noupdateinfo' -- "$2" ) )
70 } &&
71 complete -F _cr_mergerepo -o filenames mergerepo mergerepo.py
72
73 _cr_modifyrepo()
74 {
75     COMPREPLY=()
76
77     case $3 in
78         --version|-h|--help|--mdtype)
79             return 0
80             ;;
81     esac
82
83     if [[ $2 == -* ]] ; then
84         COMPREPLY=( $( compgen -W '--version --help --mdtype' -- "$2" ) )
85         return 0
86     fi
87
88     local i argnum=1
89     for (( i=1; i < ${#COMP_WORDS[@]}-1; i++ )) ; do
90         if [[ ${COMP_WORDS[i]} != -* &&
91                     ${COMP_WORDS[i-1]} != @(=|--mdtype) ]]; then
92             argnum=$(( argnum+1 ))
93         fi
94     done
95
96     case $argnum in
97         1)
98             COMPREPLY=( $( compgen -f -o plusdirs -- "$2" ) )
99             return 0
100             ;;
101         2)
102             COMPREPLY=( $( compgen -d -- "$2" ) )
103             return 0
104             ;;
105     esac
106 } &&
107 complete -F _cr_modifyrepo -o filenames modifyrepo modifyrepo.py
108
109 # Local variables:
110 # mode: shell-script
111 # sh-basic-offset: 4
112 # sh-indent-comment: t
113 # indent-tabs-mode: nil
114 # End:
115 # ex: ts=4 sw=4 et filetype=sh