-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bash-completion: pre-build the list of mock known options
Fixes: rhbz#259430
- Loading branch information
Showing
4 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#! /bin/bash | ||
|
||
mock_options=$( | ||
# shellcheck source=/dev/null | ||
. /usr/share/bash-completion/bash_completion | ||
_parse_help py/mock.py | ||
) | ||
|
||
# Some trivial assert to check it actually works | ||
case $mock_options in | ||
*--chroot*) ;; | ||
*) exit 1 ;; | ||
esac | ||
|
||
while IFS= read -r line; do | ||
case $line in | ||
*PRECOMPILED_PARSED_MOCK_HELP*) | ||
echo "echo '" | ||
echo "$mock_options" | ||
echo "'" | ||
echo "return" | ||
;; | ||
*) echo "$line" ;; | ||
esac | ||
done < ./etc/bash_completion.d/mock > "${1-mock-preprocessed}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
The Bash completion script for Mock has been improved to pre-compile the list of | ||
available Mock options at package build-time. This enhancement significantly | ||
reduces the time required for option completion from approximately 0.5 seconds | ||
(on a reasonably fast laptop) to just 0.05 seconds. [rhbz#2259430][]. |