2020-11-14 02:18:52 +00:00
|
|
|
#!/usr/bin/env nix-shell
|
|
|
|
#!nix-shell -i bash -p jq
|
2018-11-27 19:36:27 +00:00
|
|
|
|
2020-11-14 02:18:52 +00:00
|
|
|
set -e
|
|
|
|
|
|
|
|
pushd "$(dirname "$0")" &>/dev/null || exit 1
|
|
|
|
|
|
|
|
if [ "$1" == '' ]; then
|
|
|
|
echo "Please select a group: 'packages', 'images', 'addons', 'extras', or 'licenses'" >&2
|
2018-11-27 19:36:27 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2020-11-14 02:18:52 +00:00
|
|
|
namespace="$1"
|
2018-11-27 19:36:27 +00:00
|
|
|
|
2020-11-14 02:18:52 +00:00
|
|
|
if [ "$namespace" == 'licenses' ]; then
|
|
|
|
jq -r '.licenses | keys | join("\n")' < repo.json
|
|
|
|
else
|
|
|
|
jq -r --arg NAMESPACE "$namespace" \
|
|
|
|
'.[$NAMESPACE] | paths as $path | getpath($path) as $v | select($path[-1] == "displayName") | [[$NAMESPACE] + $path[:-1] | map("\"" + . + "\"") | join("."), $v] | join(": ")' \
|
|
|
|
< repo.json
|
2018-11-27 19:36:27 +00:00
|
|
|
fi
|
|
|
|
|
2020-11-14 02:18:52 +00:00
|
|
|
popd &>/dev/null
|