astronomer / astro-cli

CLI that makes it easy to create, test and deploy Airflow DAGs to Astronomer
https://www.astronomer.io
Other
351 stars 70 forks source link

Allow the option to return results in json format #583

Open paulg-mscience opened 2 years ago

paulg-mscience commented 2 years ago

✍️ Is your feature request related to a problem? Please describe.

It would be easier to programmatically use the cli if there were an option to return results in json format.

Describe the solution you'd like

Add --output param that can be either text (default) or json

💡 Additional context I realize that the houston graphql api will return json, however the simplicity of the astro cli is a nice alternative.

sunkickr commented 2 years ago

Are you an Astro Cloud or Astronomer Software user? Return results of any command?

odaneau-astro commented 1 year ago

Bumping this.

I have the need for machine-readable outputs for all commands, either JSON or YAML. Deployment inspect is not sufficient.

Here are my ugly hacks:

astro organization team delete $(astro organization team list | grep ${team_name} | rev | xargs | tr -s ' ' | cut -d ' ' -f 6 | rev)

astro organization team user remove --team-id $(astro organization team list | grep ${team_name} | rev | xargs | tr -s ' ' | cut -d ' ' -f 6 | rev) --user-id $(astro organization user list | grep ${astro_user_email} | rev | xargs | tr -s ' ' | cut -d ' ' -f 4 | rev)"

astro workspace delete $(astro workspace list | grep ${workspace_name} | rev | xargs | tr -s ' ' | cut -d ' ' -f 1 | rev)

astro workspace team add --workspace-id=$(astro workspace list | grep ${workspace_name} | rev | xargs | tr -s ' ' | cut -d ' ' -f 1 | rev) --team-id=$(astro organization team list | grep ${team_name} | rev | xargs | tr -s ' ' | cut -d ' ' -f 6 | rev)

astro deployment delete $(astro deployment list | grep ${deployment_name} | rev | xargs | tr -s ' ' | cut -d ' ' -f 1 | rev)

astro deployment service-account create --deployment-id=$(astro deployment list | grep ${deployment_name} | rev | xargs | tr -s ' ' | cut -d ' ' -f 1 | rev) --label=${label}`
BasPH commented 1 year ago

+1 for this, got another request for supporting output format consistently.

Customer specifically mentioned astro deployment list, but would ultimately like to have it in all commands.