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

feat: enables searching pins by name #10412

Merged
merged 6 commits into from
May 14, 2024
Merged

Conversation

gystemd
Copy link
Contributor

@gystemd gystemd commented Apr 27, 2024

Closes #10281.

This PR introduces the possibility to perform a search on pin names (case-sensitive, exact search). The command ipfs pin ls --name "pinName" will return all the pins labeled as pinName.

Notes:

  • The condition displayNames || name != "" is implemented to prevent redundancy in specifying the --name option. This ensures that users can simply use ipfs ls --name A instead of ipfs ls --names --name A.

@gystemd gystemd requested a review from a team as a code owner April 27, 2024 13:05
Copy link
Member

@hacdias hacdias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for submitting this! I think it's a good idea to search for the exact name matches as a first iteration. In the future, I think it could be nice to have something with regular expressions too. The code looks fine to me and thanks for adding a test.

However, it does not match exactly the idea from #10281. Below you can find some comments of suggestions of what could be changed to make it slightly more generic (using contains instead of equal).

@lidel what do you think? I'm fine either way, but I think searching for something that contains the given name could be more valuable than for exact matches only.

core/coreapi/pin.go Outdated Show resolved Hide resolved
core/commands/pin/pin.go Outdated Show resolved Hide resolved
@hacdias hacdias requested a review from lidel May 6, 2024 07:40
@gystemd
Copy link
Contributor Author

gystemd commented May 9, 2024

@hacdias Thank you for the review. I agree that it could be more beneficial to search for contained keywords. I'll wait for input from @lidel before proceeding with the suggestions you proposed.

@hacdias hacdias mentioned this pull request May 13, 2024
9 tasks
@gystemd gystemd requested a review from hacdias May 13, 2024 16:24
Copy link
Member

@hacdias hacdias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this!

@hacdias hacdias enabled auto-merge (squash) May 14, 2024 10:58
@hacdias hacdias merged commit ae05085 into ipfs:master May 14, 2024
14 checks passed
lidel added a commit to lidel/ipfs-banana that referenced this pull request May 14, 2024
ipfs#10412 changed this to partial match, but we forgot to update --help before merge
lidel added a commit that referenced this pull request May 14, 2024
#10412 changed to be partial match
but we forgot to update --help text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: 🎉 Done
Development

Successfully merging this pull request may close these issues.

ipfs pin: add ability to search/filter by name
3 participants