2 commits - createrepo.bash
[email protected] (Ville Skytt??) Mon, 19 Sep 2011 16:58:33 +0000 (UTC)
| Newsgroups | gmane.linux.rpm.metadata |
|---|---|
| Message-ID | <[email protected]> |
createrepo.bash | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) New commits: commit 1060b5f01f18e36dcde7910e031a4126fb33d87f Author: Ville Skyttä <[email protected]> Date: Mon Sep 19 19:58:14 2011 +0300 Add --compress-type and --compress completions. diff --git a/createrepo.bash b/createrepo.bash index 57b892f..f0695ba 100644 --- a/createrepo.bash +++ b/createrepo.bash @@ -1,5 +1,11 @@ # bash completion for createrepo and friends +_cr_compress_type() +{ + COMPREPLY=( $( compgen -W "$( ${1:-createrepo} --compress-type=FOO / 2>&1 \ + | sed -ne 's/,/ /g' -ne 's/.*[Cc]ompression.*://p' )" -- "$2" ) ) +} + _cr_createrepo() { COMPREPLY=() @@ -44,6 +50,10 @@ _cr_createrepo() COMPREPLY=( $( compgen -W "{1..$max}" -- "$2" ) ) return 0 ;; + --compress-type) + _cr_compress_type "$1" "$2" + return 0 + ;; esac if [[ $2 == -* ]] ; then @@ -54,7 +64,7 @@ _cr_createrepo() --skip-symlinks --changelog-limit --unique-md-filenames --simple-md-filenames --retain-old-md --distro --content --repo --revision --deltas --oldpackagedirs --num-deltas --read-pkgs-list - --max-delta-rpm-size --workers --xz' -- "$2" ) ) + --max-delta-rpm-size --workers --xz --compress-type' -- "$2" ) ) else COMPREPLY=( $( compgen -d -- "$2" ) ) fi @@ -73,10 +83,14 @@ _cr_mergerepo() COMPREPLY=( $( compgen -d -- "$2" ) ) return 0 ;; + --compress-type) + _cr_compress_type "" "$2" + return 0 + ;; esac COMPREPLY=( $( compgen -W '--version --help --repo --archlist --no-database - --outputdir --nogroups --noupdateinfo --xz' -- "$2" ) ) + --outputdir --nogroups --noupdateinfo --compress-type' -- "$2" ) ) } && complete -F _cr_mergerepo -o filenames mergerepo mergerepo.py @@ -88,18 +102,22 @@ _cr_modifyrepo() --version|-h|--help|--mdtype) return 0 ;; + --compress-type) + _cr_compress_type "" "$2" + return 0 + ;; esac if [[ $2 == -* ]] ; then - COMPREPLY=( $( compgen -W '--version --help --mdtype --remove' \ - -- "$2" ) ) + COMPREPLY=( $( compgen -W '--version --help --mdtype --remove + --compress --compress-type' -- "$2" ) ) return 0 fi local i argnum=1 for (( i=1; i < ${#COMP_WORDS[@]}-1; i++ )) ; do if [[ ${COMP_WORDS[i]} != -* && - ${COMP_WORDS[i-1]} != @(=|--mdtype) ]]; then + ${COMP_WORDS[i-1]} != @(=|--@(md|compress-)type) ]]; then argnum=$(( argnum+1 )) fi done commit 8de5106ceb8081fa157abb122e6869d54df7e890 Author: Ville Skyttä <[email protected]> Date: Mon Sep 19 19:56:27 2011 +0300 Add createrepo --workers argument completion. diff --git a/createrepo.bash b/createrepo.bash index 5a32a01..57b892f 100644 --- a/createrepo.bash +++ b/createrepo.bash @@ -5,7 +5,7 @@ _cr_createrepo() COMPREPLY=() case $3 in - --version|-h|--help|-u|--baseurl|--distro|--content|--repo|--workers|\ + --version|-h|--help|-u|--baseurl|--distro|--content|--repo|\ --revision|-x|--excludes|--changelog-limit|--max-delta-rpm-size) return 0 ;; @@ -38,6 +38,12 @@ _cr_createrepo() COMPREPLY=( $( compgen -W '1 2 3 4 5 6 7 8 9' -- "$2" ) ) return 0 ;; + --workers) + local min=2 max=$( getconf _NPROCESSORS_ONLN 2>/dev/null ) + [[ -z $max || $max -lt $min ]] && max=$min + COMPREPLY=( $( compgen -W "{1..$max}" -- "$2" ) ) + return 0 + ;; esac if [[ $2 == -* ]] ; then _______________________________________________ Rpm-metadata mailing list [email protected] http://lists.baseurl.org/mailman/listinfo/rpm-metadata