Add a JSON output mode
Implement the --output=[plain|json]
flag to control whether
output should be the legacy text one or structured JSON for
further elaboration.
Sample output:
$ gitlab-rulez --output json diff --filter pkg/z* rulez.yaml | jq
{
"actions": [
{
"project": {
"id": 6315,
"path_with_namespace": "pkg/zeitgeist"
},
"kind": "settings",
"description": "set default_branch to apertis/v2024dev3"
},
{
"project": {
"id": 6315,
"path_with_namespace": "pkg/zeitgeist"
},
"kind": "settings",
"description": "save changes",
"error": "400: {'base': [\"Could not change HEAD: branch 'apertis/v2024dev3' does not exist\"]}"
},
{
"project": {
"id": 8265,
"path_with_namespace": "pkg/zict"
},
"kind": "settings",
"description": "set default_branch to apertis/v2024dev3"
},
{
"project": {
"id": 8265,
"path_with_namespace": "pkg/zict"
},
"kind": "settings",
"description": "save changes",
"error": "400: {'base': [\"Could not change HEAD: branch 'apertis/v2024dev3' does not exist\"]}"
}
]
}
$ gitlab-rulez --output json list-projects --filter pkg/zc* | jq
[
{
"id": 10147,
"path_with_namespace": "pkg/zc.buildout"
},
{
"id": 10148,
"path_with_namespace": "pkg/zc.lockfile"
}
]
Edited by Emanuele Aina