Format output as JSON
Describe the feature or problem you'd like to solve I'm trying to use glab in my CI, but the lack of easily parsable output makes it difficult to work with. Right now, I use regex to extract what I need, which is more complicated than it needs to be.
Propose a Solution
A flag such as --output=json|yaml|... or --format=json|yaml|....
As an alternative, I could directly use the GitLab API, but I find the glab CLI to be far more elegant and easier to understand.
Additional context I've searched the issues and PRs and could not find something that matches what I describe.
@mboutet thanks for opening this issue.
I have actually considered adding a global --json flag to most of the commands but I haven't had time to think about the implementation.
I will definitely add this to my backlog but it is open for PRs.
Before then, just to bring to your notice that glab has the api command that allows you to interact with the GitLab API directly and the output is json formatted.
With the api and alias commands, you can define your own custom commands if needed.
I gave an example on how to define custom commands using both the api and alias commands here: https://github.com/profclems/glab/issues/655#issuecomment-799313512