Skip to content

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

Open
@stellarpower

Description

@stellarpower

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions