23 lines
982 B
Bash
23 lines
982 B
Bash
#!/usr/bin/env sh
|
|
set -eu
|
|
|
|
target=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
|
source="${XDG_CONFIG_HOME:-$HOME/.config}/zed"
|
|
|
|
cp "$source/settings.json" "$target/settings.json"
|
|
cp "$source/keymap.json" "$target/keymap.json"
|
|
cp "$source/scripts/toggle-file-scan-exclusions.mjs" "$target/scripts/toggle-file-scan-exclusions.mjs"
|
|
cp "$source/scripts/file-exclusions.json" "$target/scripts/file-exclusions.json"
|
|
cp "$source/scripts/zed-settings-sync.mjs" "$target/scripts/zed-settings-sync.mjs"
|
|
|
|
node - "$source/tasks.json" "$target/tasks.json" "$source/scripts/toggle-file-scan-exclusions.mjs" "$source/scripts/zed-settings-sync.mjs" <<'NODE'
|
|
const fs = require("node:fs");
|
|
const [source, target, toggleScript, syncScript] = process.argv.slice(2);
|
|
const tasks = fs.readFileSync(source, "utf8")
|
|
.replaceAll(toggleScript, "__TOGGLE_SCRIPT__")
|
|
.replaceAll(syncScript, "__SYNC_SCRIPT__");
|
|
fs.writeFileSync(target, tasks);
|
|
NODE
|
|
|
|
printf 'Exported Zed configuration from %s\n' "$source"
|