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

xrepo info in Machine-PArseable format (JSON/YAML) #60

Open
stellarpower opened this issue Jan 13, 2025 · 1 comment
Open

xrepo info in Machine-PArseable format (JSON/YAML) #60

stellarpower opened this issue Jan 13, 2025 · 1 comment

Comments

@stellarpower
Copy link

Is your feature request related to a problem? Please describe.

I'm looking to query the installed packages as part of a script.

The current output is pretty and nicely-formatted, but it would be nice to query in JSON or YAML for using directly with jq or similar:

$ xrepo info qt6base
The package info of project:
    require(7z): 
      -> description: A file archiver with a high compression ratio.
      -> version: 21.02
      -> urls:
         -> https://github.com/xmake-mirror/7zip/archive/refs/tags/21.02.tar.gz
            -> b2a4c5bec8207508b26f94507f62f5a79c57ae9ab77dbf393f3b2fc8eef2e382
         -> https://github.com/xmake-mirror/7zip.git
            -> 21.02
      -> repo: xmake-repo https://github.com/xmake-io/xmake-repo.git master
      -> cachedir: /root/.xmake/cache/packages/2501/7/7z/21.02
      -> installdir: /root/.xmake/packages/7/7z/21.02/4f693dda07774e26b31a8135e6fa21ad
      -> searchdirs: 
      -> searchnames:
         -> 7zip-21.02.tar.gz
         -> 21.02.tar.gz
         -> 7z (git)
         -> 7z-21.02.tar.gz
         -> 7zip (git)

Describe the solution you'd like

A flag that will enable toggling output format, or a --yaml/--json etc. flag

Describe alternatives you've considered

Personally I tend to prefer YAML as it's easier for me to read and as useful to the machine as JSON, and so might be possible to output in just one format for user and machine consumption. However, many tools have a -j flag for JSON as a standard so this might be preferable.

IT may also be best to enable this as a global command and integrated higher up in xmake as a whole.

Additional context

No response

@waruqi
Copy link
Member

waruqi commented Jan 14, 2025

yaml requires the introduction of additional dependencies. We are only considering supporting json, but we don’t have time to support it at the moment. You can directly submit a PR.

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

No branches or pull requests

2 participants