#!/usr/bin/fish for i in (stack ls dependencies --license --external | cut -d ' ' -f 2 | sort -u); echo "# Licensed under $i:"; stack ls dependencies --license --external | grep $i | cut -d ' ' -f 1 | sort -u | sed 's/^/- /'; echo ""; echo ""; end > dependency-licenses.md