Skip to repository content57 lines · 1.6 KB · text
tenant.openagents/omega
No repository description is available.
OpenAgents Git authority 2026-07-28T01:30:20.020Z Public web read
NIP-34 coordinate
30617:7649603503856e5148d571eac2766b288a8ff1e9e35d380337a1d2b0015b4f92:omegaMaintainersHidden in public view
References2 branches · 1 tag
Read-only clone
git clone https://openagents.com/git/tenant.openagents/omega.gitBrowse files
generate-licenses
1#!/usr/bin/env bash
2
3set -euo pipefail
4
5CARGO_ABOUT_VERSION="0.8.2"
6OUTPUT_FILE="${1:-$(pwd)/assets/licenses.md}"
7TEMPLATE_FILE="script/licenses/template.md.hbs"
8
9fail_on_stderr() {
10 local tmpfile=$(mktemp)
11 "$@" 2> >(tee "$tmpfile" >&2)
12 local rc=$?
13 [ -s "$tmpfile" ] && rc=1
14 rm "$tmpfile"
15 return $rc
16}
17
18echo -n "" >"$OUTPUT_FILE"
19
20{
21 echo -e "# ###### THEME LICENSES ######\n"
22 cat assets/themes/LICENSES
23
24 echo -e "\n# ###### ICON LICENSES ######\n"
25 cat assets/icons/LICENSES
26
27 echo -e "\n# ###### CODE LICENSES ######\n"
28} >>"$OUTPUT_FILE"
29
30if ! cargo about --version | grep "cargo-about $CARGO_ABOUT_VERSION" &>/dev/null; then
31 echo "Installing cargo-about@$CARGO_ABOUT_VERSION..."
32 cargo install "cargo-about@$CARGO_ABOUT_VERSION"
33else
34 echo "cargo-about@$CARGO_ABOUT_VERSION is already installed."
35fi
36
37echo "Generating cargo licenses"
38if [ -z "${ALLOW_MISSING_LICENSES-}" ]; then FAIL_FLAG=--fail; else FAIL_FLAG=""; fi
39if [ -z "${ALLOW_MISSING_LICENSES-}" ]; then WRAPPER=fail_on_stderr; else WRAPPER=""; fi
40set -x
41$WRAPPER cargo about generate \
42 $FAIL_FLAG \
43 -c script/licenses/zed-licenses.toml \
44 "$TEMPLATE_FILE" >>"$OUTPUT_FILE"
45set +x
46
47sed -i.bak 's/"/"/g' "$OUTPUT_FILE"
48sed -i.bak 's/'/'\''/g' "$OUTPUT_FILE" # The ` '\'' ` thing ends the string, appends a single quote, and re-opens the string
49sed -i.bak 's/=/=/g' "$OUTPUT_FILE"
50sed -i.bak 's/`/`/g' "$OUTPUT_FILE"
51sed -i.bak 's/</</g' "$OUTPUT_FILE"
52sed -i.bak 's/>/>/g' "$OUTPUT_FILE"
53
54rm -rf "${OUTPUT_FILE}.bak"
55
56echo "generate-licenses completed. See $OUTPUT_FILE"
57