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

search for alternatives providers with xbps-query? #499

Open
classabbyamp opened this issue Jul 19, 2022 · 3 comments
Open

search for alternatives providers with xbps-query? #499

classabbyamp opened this issue Jul 19, 2022 · 3 comments

Comments

@classabbyamp
Copy link
Member

xbps-query -Rp alternatives -s vi returns nothing currently (exits 2). perhaps it should search for all packages that provide the vi alternative set.

@anddam
Copy link

anddam commented Jul 19, 2022

perhaps it should search for all packages that provide the vi alternative set.

Yeah, that would be handy.

@Duncaen
Copy link
Member

Duncaen commented Jul 19, 2022

The way the packages alternatives property is setup and how we print properties would require special handling for this case.

I added a repository mode to xbps-alternatives, which provides the same functionality and fits better imho #340.

@dmarto
Copy link

dmarto commented Oct 8, 2022

Lurking around I found this issue, and I remembered I have a patch for that dmarto@90d2891

My use case is the following script (that I use in combo with another one to find files that are not created/managed/owned by a package).

#!/bin/bash
# xalts [STRING]
#  alternatives search, prints results in xbps-query -o compatible way

while read alt; do
    [ -z "${alt}" ] && continue

    alt=${alt% (*)}

    pkg=${alt%%:*}

    real=${alt##*:}

    dir=$(dirname "$real")

    link=${alt#*: }
    link=${link%:*}
    [ "$(dirname "$link")" = "." ] && link="$dir/$link"

    echo "$pkg: $link -> $real (link)"

done <<< $(x xbps-query -R -p alternatives --search="$1")

If it is of intereset, I could open a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants