Skip to content

Commit 0090eb6

Browse files
committed
- Improve performance of rush list and package name completion
1 parent 11f1305 commit 0090eb6

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

op.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ generate: bashly generate --upgrade
44
watch: op generate --watch
55
#? watch files and regenerate script on change
66

7-
test: docker compose run --rm test
7+
test: docker compose run test
88
#? run tests in a container
99

1010
shellcheck: shellcheck rush setup && echo "PASS"

rush

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
2-
# This script was generated by bashly 1.0.4 (https://bashly.dannyb.co)
2+
# This script was generated by bashly 1.0.7 (https://bashly.dannyb.co)
33
# Modifying it manually is not recommended
44

55
# :wrapper.bash3_bouncer
@@ -1747,10 +1747,6 @@ rush_list_command() {
17471747
local repo="$repo_or_package"
17481748
local package glob repo_path infofile regex package_name
17491749

1750-
if [[ $all ]]; then
1751-
shopt -s globstar
1752-
fi
1753-
17541750
if [[ $repo_or_package =~ (.*):(.*) ]]; then
17551751
repo=${BASH_REMATCH[1]}
17561752
package=${BASH_REMATCH[2]}
@@ -1767,7 +1763,12 @@ rush_list_command() {
17671763
if [[ $package ]]; then
17681764
glob=("$repo_path"/"$package"/**/info)
17691765
else
1770-
glob=("$repo_path"/**/info)
1766+
if [[ $all ]]; then
1767+
glob_files=$(find "$repo_path" -type f -name 'info')
1768+
else
1769+
glob_files=$(find "$repo_path" -maxdepth 2 -type f -name 'info')
1770+
fi
1771+
readarray -t glob < <(echo "${glob_files[@]}")
17711772
fi
17721773

17731774
if [[ ${glob[0]} =~ .*\*.* ]]; then

src/list_command.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ list_show_repo() {
2424
local repo="$repo_or_package"
2525
local package glob repo_path infofile regex package_name
2626

27-
if [[ $all ]]; then
28-
shopt -s globstar
29-
fi
30-
3127
if [[ $repo_or_package =~ (.*):(.*) ]]; then
3228
repo=${BASH_REMATCH[1]}
3329
package=${BASH_REMATCH[2]}
@@ -44,7 +40,12 @@ list_show_repo() {
4440
if [[ $package ]]; then
4541
glob=("$repo_path"/"$package"/**/info)
4642
else
47-
glob=("$repo_path"/**/info)
43+
if [[ $all ]]; then
44+
glob_files=$(find "$repo_path" -type f -name 'info')
45+
else
46+
glob_files=$(find "$repo_path" -maxdepth 2 -type f -name 'info')
47+
fi
48+
readarray -t glob < <(echo "${glob_files[@]}")
4849
fi
4950

5051
if [[ ${glob[0]} =~ .*\*.* ]]; then

0 commit comments

Comments
 (0)