mirror of
https://github.com/gburd/nix-config.git
synced 2024-11-20 10:36:25 +00:00
f3fd89af54
Many thangs to the hard work and generous availability of: git@github.com:Misterio77/nix-config.git
14 lines
601 B
Bash
Executable file
14 lines
601 B
Bash
Executable file
#!/usr/bin/env nix-shell
|
|
#!nix-shell -i bash -p jq httpie
|
|
|
|
image="$(echo "$1" | rev | cut -d '/' -f1 | rev | cut -d '.' -f1)"
|
|
clientid="0c2b2b57cdbe5d8"
|
|
|
|
image=$(https api.imgur.com/3/image/$image Authorization:"Client-ID $clientid" | jq -r '.data | "\(.description)|\(.type)|\(.id)"')
|
|
|
|
jq -n \
|
|
--arg name "$(echo $image | cut -d '|' -f 1)" \
|
|
--arg ext "$(echo $image | cut -d '|' -f 2 | cut -d '/' -f 2)" \
|
|
--arg id "$(echo $image | cut -d '|' -f 3)" \
|
|
--arg sha256 "$(nix-prefetch-url https://i.imgur.com/$id.$ext)" \
|
|
'{"name": $name, "ext": $ext, "id": $id, "sha256": $sha256}'
|