Assorted shell and Python scripts
1#!/usr/bin/env bash
2
3set -euo pipefail
4
5# Fetch an open source license
6
7base_url="https://api.github.com/licenses"
8headers="Accept: application/vnd.github.drax-preview+json"
9
10if (( $# == 0 )); then
11 res=$(curl --silent --header $headers $base_url)
12 selection=$(echo "$res" | jq ".[].key" | tr -d '"' | gum choose --limit=1)
13else
14 selection="$argv[1]"
15fi
16
17res=$(curl --silent --header $headers $base_url/$selection | jq ."body")
18echo -e $res | tr -d '"'