mirror of
https://codeberg.org/hyperreal/dotfiles
synced 2024-11-01 16:53:07 +01:00
Add function to fetch FOSS licenses
This commit is contained in:
parent
c57e04c615
commit
89ab5ae878
@ -41,3 +41,24 @@ EOF
|
|||||||
) | bat -p
|
) | bat -p
|
||||||
}
|
}
|
||||||
|
|
||||||
|
## fetch open source license
|
||||||
|
license() {
|
||||||
|
local base_url
|
||||||
|
base_url="https://api.github.com/licenses"
|
||||||
|
|
||||||
|
local headers
|
||||||
|
headers="Accept: application/vnd.github.drax-preview+json"
|
||||||
|
|
||||||
|
local res
|
||||||
|
if (( $# == 0 )); then
|
||||||
|
res=$(curl --silent --header $headers $base_url)
|
||||||
|
|
||||||
|
echo "Available licenses:"
|
||||||
|
echo
|
||||||
|
echo "$res" | jq ".[].key" | tr -d '"'
|
||||||
|
fi
|
||||||
|
|
||||||
|
local license="$argv[1]"
|
||||||
|
res=$(curl --silent --header $headers $base_url/$license | jq ."body")
|
||||||
|
echo -e $res | tr -d '"'
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user