Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Support --output/-o flag globally for yaml, json, and csv outputs #42

Open
2 tasks done
jpmcb opened this issue Sep 27, 2023 · 1 comment
Open
2 tasks done

Comments

@jpmcb
Copy link
Member

jpmcb commented Sep 27, 2023

Type of feature

πŸ• Feature

Current behavior

There's no great way to "save" contributions besides piping the table output through standard out to a file:

❯ pizza insights contributors https://github.com/open-sauced/api > my-api-stats.txt
❯ cat my-api-stats.txt

 Repository URL        https://github.com/open-sauced/api
 New contributors      3
 Recent contributors   8
 Alumni contributors   4
 Repeat contributors   5

That works great, but the our output table isn't really standardized and doesn't allow for much composability with other CLI or data tools.

We should aim to support 3 formats wherever possible: yaml, json, and csv.

Suggested solution

Add a --output/-o flag that accepts yaml, json, or csv

❯ pizza insights contributors https://github.com/open-sauced/api -o csv
Repository URL, New contributors, Recent contributors, Alumni contributors, Repeat contributors, Repeat contributors
https://github.com/open-sauced/api, 3, 8, 4, 5

this can then be piped to a .csv file and loaded into common programs like Excel.

The yaml and json outputs are alittle more straightforward:

❯ pizza insights contributors https://github.com/open-sauced/api -o
---
Repository URL: https://github.com/open-sauced/api
New contributors: 3
Recent contributors: 8
Alumni contributors: 4
Repeat contributors: 5
❯ pizza insights contributors https://github.com/open-sauced/api -o
{
	"Repository URL": "https: //github.com/open-sauced/api",
	"New contributors": 3,
	"Recent contributors": 8,
	"Alumni contributors": 4,
	"Repeat contributors": 5
}

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Contributing Docs

  • I agree to follow this project's Contribution Docs
@cecobask
Copy link
Contributor

cecobask commented Sep 27, 2023

The groundwork for this functionality can be found in this pull request: #38
I've implemented the output options (table, json, yaml) for all subcommands of pizza insights.
The only thing missing as of now is support for csv output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants