You are not logged in.

#1 2022-08-27 12:37:06

mamograg17
Member
Registered: 2022-02-08
Posts: 21

[SOLVED]How to get a random package from arch repository web interface

Hello,
I am developing a GUI application that retrieves applications' information from arch repository interface as json format, now i want to show some random packages to user when he scrolls, but i found no option to do it,

please any idea ?

Last edited by mamograg17 (2022-08-27 13:07:27)

Offline

#2 2022-08-27 12:58:06

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 27,272
Website

Re: [SOLVED]How to get a random package from arch repository web interface

pkgname=$(pacman -Ssq | shuf | sed 1q)

Or, without more context, perhaps something like this would suffice.

Last edited by Trilby (2022-08-27 12:59:54)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2022-08-27 13:05:38

mamograg17
Member
Registered: 2022-02-08
Posts: 21

Re: [SOLVED]How to get a random package from arch repository web interface

Trilby wrote:
pkgname=$(pacman -Ssq | shuf | sed 1q)

Or, without more context, perhaps something like this would suffice.

That's it!

Thank you, i'll put the packages' output in a string and get it information and show it.

Offline

#4 2022-08-27 13:22:02

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 27,272
Website

Re: [SOLVED]How to get a random package from arch repository web interface

Okay ... I'm glad that helped ... kinda'

I doubt you are writing this application in bash.  So this was rather more to clarify the question.  I find it unlikely that you'd be using a programming language without knowing how to select a random element from a list in that language.  So I'm not sure how showing it being done in bash (which is a poor way of doing it) could be all that useful.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#5 2022-08-28 12:40:30

mamograg17
Member
Registered: 2022-02-08
Posts: 21

Re: [SOLVED]How to get a random package from arch repository web interface

Trilby wrote:

Okay ... I'm glad that helped ... kinda'

I doubt you are writing this application in bash.  So this was rather more to clarify the question.  I find it unlikely that you'd be using a programming language without knowing how to select a random element from a list in that language.  So I'm not sure how showing it being done in bash (which is a poor way of doing it) could be all that useful.

Actually no, I am not writing in bash, I use C++ to make a GUI package manager.

Actually I know how to get a random thing in C++ but it wasn't helpful in my situation, cause I want a correct name to display.

Offline

Board footer

Powered by FluxBB