microsoft / microsoft/knack

csv output option

Open
#187 0 comments 1 reaction 1 assignee View on GitHub

@jiasli is already working on this.

Since Mar 31, 2020.

area/output type/proposal
Dominant language
Python
Stars
358
Forks
101
PR merge metrics
No merged PRs in 30d

Description

Originally reported at https://github.com/Azure/azure-cli/issues/12624 by @johanburati


Would be good to have a csv output option, so that we could easily extract fields using good old linux cli commands and without redoing any formatting of any kind.

Like in the example below the first field has space in it.

$  az account list-locations -o table
DisplayName           Latitude    Longitude    Name
--------------------  ----------  -----------  ------------------
East Asia             22.267      114.188      eastasia
Southeast Asia        1.283       103.833      southeastasia
Central US            41.5908     -93.6208     centralus
East US               37.3719     -79.8164     eastus
East US 2             36.6681     -78.3889     eastus2
West US               37.783      -122.417     westus

Would be good to have this:

$  az account list-locations -o csv
East Asia,22.267,114.188,eastasia
Southeast Asia,1.283,103.833,southeastasia
Central US,41.5908,-93.6208,centralus
East US,37.3719,-79.8164,eastus
East US,2,36.6681,-78.3889,eastus2
West US,37.783,-122.417,westus
North Central US,41.8819,-87.6278,northcentralus
South Central US,29.4167,-98.5,southcentralus

So we can do things like this:

 $  az account list-locations -o csv | awk -F, '{ print  $4" -> "$1 }'
eastasia -> East Asia
southeastasia -> Southeast Asia
centralus -> Central US
eastus -> East US
eastus2 -> East US 2
westus -> West US

I think this option could come handy sometimes.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.