From 9962939d70e11f51bfd000aac7053dc2da81ca55 Mon Sep 17 00:00:00 2001 From: Merlin Mathesius Date: Apr 09 2019 19:28:00 +0000 Subject: Revise shell completion for module scratch builds to require SRPMs to be specified individually using multiple '--srpm SRPM' options, and enable completion of modulemd file path by yaml extension. Signed-off-by: Merlin Mathesius --- diff --git a/conf/bash-completion/fedpkg.bash b/conf/bash-completion/fedpkg.bash index a045e61..2a1d11e 100644 --- a/conf/bash-completion/fedpkg.bash +++ b/conf/bash-completion/fedpkg.bash @@ -88,8 +88,9 @@ _fedpkg() # parse command specific options local options= - local options_target= options_arches= options_branch= options_string= options_file= options_dir= options_srpm= options_srpms= options_mroot= options_builder= options_namespace= + local options_target= options_arches= options_branch= options_string= options_file= options_dir= options_srpm= options_mroot= options_builder= options_namespace= local options_update_type= options_update_request= + local options_yaml= local after= after_more= case $command in @@ -166,14 +167,14 @@ _fedpkg() module-build) options="--scratch --watch" options_string="--optional --requires --buildrequires" - options_file="--file" - options_srpms="--srpms" + options_yaml="--file" + options_srpm="--srpm" ;; module-build-local) options="--skip-tests" options_string="--add-local-build --stream --set-default-stream" - options_file="--file" - options_srpms="--srpms" + options_yaml="--file" + options_srpm="--srpm" ;; module-overview) options="--unfinished" @@ -182,8 +183,8 @@ _fedpkg() module-scratch-build) options="--watch" options_string="--optional --requires --buildrequires" - options_file="--file" - options_srpms="--srpms" + options_yaml="--file" + options_srpm="--srpm" ;; patch) options="--rediff" @@ -244,8 +245,9 @@ _fedpkg() local all_options="--help $options" local all_options_value="$options_target $options_arches $options_branch \ - $options_string $options_file $options_dir $options_srpm $options_srpms $options_mroot \ - $options_builder $options_namespace $options_update_type $options_update_request" + $options_string $options_file $options_dir $options_srpm $options_mroot \ + $options_builder $options_namespace $options_update_type $options_update_request \ + $options_yaml" # count non-option parameters @@ -278,8 +280,8 @@ _fedpkg() elif [[ -n $options_srpm ]] && in_array "$prev" "$options_srpm"; then _filedir_exclude_paths "*.src.rpm" - elif [[ -n $options_srpms ]] && in_array "$last_option" "$options_srpms"; then - _filedir_exclude_paths "*.src.rpm" + elif [[ -n $options_yaml ]] && in_array "$prev" "$options_yaml"; then + _filedir_exclude_paths "yaml" elif [[ -n $options_branch ]] && in_array "$prev" "$options_branch"; then COMPREPLY=( $(compgen -W "$(_fedpkg_branch "$path")" -- "$cur") ) diff --git a/conf/zsh-completion/_fedpkg b/conf/zsh-completion/_fedpkg index 1ba63bf..405f13c 100644 --- a/conf/zsh-completion/_fedpkg +++ b/conf/zsh-completion/_fedpkg @@ -226,8 +226,8 @@ _fedpkg-module-build () { '--requires[Requires to override in the form of "name:stream"]' \ '--optional[MBS optional arguments in the form of "key=value"]:optional' \ '--scratch[Perform a scratch build]' \ - '--file[The modulemd yaml file for module scratch build.]:file:_files' \ - '--srpms[Include one or more srpms for module scratch build.]:*:srpms:_files -g "*.src.rpm"' \ + '--file[The modulemd yaml file for module scratch build.]:file:_files -g "*.yaml"' \ + '*--srpm[Include srpm for module scratch build.]:srpm:_files -g "*.src.rpm"' \ ':scm_url' \ ':branch' } @@ -254,8 +254,8 @@ _fedpkg-module-build-local () { '--add-local-build[Import previously finished local module builds into MBS]:build_id' \ '--stream[The module'\''s stream/SCM branch.]:stream' \ '(--set-default-stream -s)'{--set-default-stream,-s}'[Set the default stream for given module dependency.]:default_stream' \ - '--file[The module'\''s modulemd yaml file.]:file:_files' \ - '--srpms[Include one or more srpms for module build.]:*:srpms:_files -g "*.src.rpm"' \ + '--file[The module'\''s modulemd yaml file.]:file:_files -g "*.yaml"' \ + '*--srpm[Include srpm for module build.]:srpm:_files -g "*.src.rpm"' \ ':scm_url' \ ':branch' } @@ -283,8 +283,8 @@ _fedpkg-module-scratch-build () { '--buildrequires[Buildrequires to override in the form of "name:stream"]' \ '--requires[Requires to override in the form of "name:stream"]' \ '--optional[MBS optional arguments in the form of "key=value"]:optional' \ - '--file[The modulemd yaml file for module scratch build.]:file:_files' \ - '--srpms[Include one or more srpms for module scratch build.]:*:srpms:_files -g "*.src.rpm"' \ + '--file[The modulemd yaml file for module scratch build.]:file:_files -g "*.yaml"' \ + '*--srpm[Include srpm for module scratch build.]:srpm:_files -g "*.src.rpm"' \ ':scm_url' \ ':branch' }