Skip to content

Commit b39d7e4

Browse files
committed
Add local install instructions and analysis example
1 parent a2231a2 commit b39d7e4

1 file changed

Lines changed: 28 additions & 5 deletions

File tree

README.md

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,15 +171,23 @@ and retrieve the images.
171171
Using the `github-stats` CLI (available on the
172172
[releases](https://github.com/jstrieb/github-stats/releases/latest) page) to
173173
run locally, you can dump raw statistics data to a JSON file using the
174-
`--json-output-file` command-line argument. Then, you can import the JSON file
175-
into your programming language of choice and start analyzing.
174+
`--json-output-file` command-line argument.
176175

177-
My preference is to use [`jq`](https://github.com/jqlang/jq) from the command
178-
line. The command-line examples below assume the JSON file is stored in
176+
``` bash
177+
sudo curl --location --output '/usr/local/bin/github-stats' 'https://github.com/jstrieb/github-stats/releases/latest/download/github-stats_x86_64-linux'
178+
sudo chmod +x /usr/local/bin/github-stats
179+
github-stats --version
180+
181+
github-stats --access-token [YOUR API KEY] --json-output-file stats.json --debug
182+
```
183+
184+
Then, you can import the JSON file into your programming language of choice and
185+
start analyzing. My preference is to use [`jq`](https://github.com/jqlang/jq)
186+
from the command line. The examples below assume the JSON file is stored in
179187
`stats.json`.
180188

181189

182-
### List all
190+
### List All
183191

184192
List all repositories, sorted with most-viewed at the bottom.
185193

@@ -193,6 +201,21 @@ removes the languages field (using `del()`) because it can clutter the output,
193201
making it hard to read.
194202

195203

204+
### List Languages
205+
206+
List all languages, sorted with most-used at the bottom.
207+
208+
``` bash
209+
jq --raw-output '
210+
[.repositories[].languages[]]
211+
| group_by(.name)
212+
| sort_by([.[].size] | add)
213+
| .[]
214+
| "\(.[0].name): \([.[].size] | add)"
215+
' stats.json
216+
```
217+
218+
196219
## Support the Project
197220

198221
If this project is useful to you, please support it!

0 commit comments

Comments
 (0)