lemmy/scripts/update_config_defaults.sh

14 lines
302 B
Bash
Raw Permalink Normal View History

#!/bin/bash
set -e
dest=${1-config/defaults.hjson}
cargo run -- --print-config-docs > "$dest"
# replace // comments with #
sed -i "s/^\([[:space:]]*\)\/\//\1#/" "$dest"
# remove trailing commas
sed -i "s/,\$//" "$dest"
# remove quotes around json keys
sed -i "s/\"//" "$dest"
sed -i "s/\"//" "$dest"