Skip to content

Instantly share code, notes, and snippets.

@goyalmohit
Last active July 15, 2019 23:47
Show Gist options
  • Save goyalmohit/fb5d5d9655e07c1b626367e2a2cab47c to your computer and use it in GitHub Desktop.
Save goyalmohit/fb5d5d9655e07c1b626367e2a2cab47c to your computer and use it in GitHub Desktop.
"""
Parse output from az pipelines list command into a nice format using python
Below code assumes that output from 'az pipelines list' command has been stored
under the az-pipelines-list.json file
"""
import sys, json
with open("working-with-azure-devops-pipelines-at-command-line/az-pipelines-list.json", "r") as f:
pipelines = json.load(f)
print(f"PipelineName \t CreationDate \t AuthoredBy \t ProjectName")
for item in pipelines:
authored_by = item['authoredBy']['displayName']
project_name = item['project']['name']
print(f"{item['name']} \t {item['createdDate']} \t {authored_by} {project_name}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment