Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rush search not searching package names #81

Closed
pcrockett opened this issue Oct 26, 2024 · 7 comments
Closed

rush search not searching package names #81

pcrockett opened this issue Oct 26, 2024 · 7 comments
Labels
bug Something isn't working

Comments

@pcrockett
Copy link

As of 0.7.14 it seems Rush doesn't search package names.

Steps to reproduce:

export RUSH_CONFIG="${HOME}/.config/rush/config"
export RUSH_ROOT="${HOME}/.local/share/rush"
rush clone pcrockett --ssh --default
rush search tagref

output of last command is:

Matching packages:


Matching info files:


... but should show https://github.com/pcrockett/rush-repo/blob/main/tagref/info

Running Archlinux. I haven't dug into the code yet to troubleshoot, but was wondering first if it broke for anyone else.

@DannyBen
Copy link
Owner

Weird. Search works for my repo without a problem, but I can confirm it does not when I use these repro steps in a clean docker environment:

docker run --rm -it dannyben/rush
mkdir -p "${HOME}/.config/rush"
export RUSH_CONFIG="${HOME}/.config/rush/config"
export RUSH_ROOT="${HOME}/.local/share/rush"
rush clone pcrockett --default
rush search zed

output:

$ rush search zed
Matching packages:


Matching info files:

kbgrep: A search tool optimized for knowledgebases

The search for words in package files works, but the first search for package names does not.
I am checking why.

@DannyBen
Copy link
Owner

Found the problem:

The package search find is running this:

find "$repo_path" -type d -not -path '*/\.*'

which ignores any folder that has a /. in it (to ignore .git for example).
Since you are storing your repos in ~/.local - all are ignored during that search.

@DannyBen DannyBen added the bug Something isn't working label Oct 27, 2024
@DannyBen
Copy link
Owner

Can you try the rush executable from #82 ?

@pcrockett
Copy link
Author

Fixes my issue, thanks. Though I left a comment on the PR for you.

@DannyBen
Copy link
Owner

DannyBen commented Oct 27, 2024

Updated the code with:

  1. bold instead of blue titles
  2. titles will now show the repository name
  3. merged multiple sed commands to one
  4. revised logic for finding package name

## Search directories matching search text
bold "Matching packages ($repo):\n"
find "$repo_path" -type f -name main |
sed "s#${repo_path}/#${prefix}#g; s#/main##" |
grep --color=always --ignore-case "$text" |
sort
## Search info files matching search text
bold "\nMatching info files ($repo):\n"
grep --color=always --initial-tab --recursive --ignore-case --include "info" \
"$text" "$repo_path" |
sed "s#${repo_path}/#${prefix}#g; s#/info##" |
sort

Originally I used -printf "%h\n" option in find, but it seems to be incompatible with some find versions.

@pcrockett
Copy link
Author

Latest version works fine for me. Thanks for the fix.

@DannyBen
Copy link
Owner

Version 0.7.15 is released with this fix.
Thanks for the report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants