From 6b62c2395c398308ac64267cd9ae553000551619 Mon Sep 17 00:00:00 2001 From: Aditya Date: Wed, 4 May 2022 14:16:16 +0530 Subject: [PATCH] initial commit --- README.md | 8 ++++++++ sizeof.sh | 8 ++++++++ 2 files changed, 16 insertions(+) create mode 100644 README.md create mode 100644 sizeof.sh diff --git a/README.md b/README.md new file mode 100644 index 0000000..3397583 --- /dev/null +++ b/README.md @@ -0,0 +1,8 @@ +# sizeof +print size of a github repo + +## Requirements +jq, curl, GNU coreutils + +## Usage +pass `username/repo` as argument to the script diff --git a/sizeof.sh b/sizeof.sh new file mode 100644 index 0000000..592651e --- /dev/null +++ b/sizeof.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +sizeof() { + curl -s https://api.github.com/repos/$1 | jq '.size' | numfmt --to-iec --from-unit=1024 +} + +size=$(sizeof $1) +echo $size