22 lines
496 B
Bash
Executable File
22 lines
496 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
PATH_ARG="${1:-}"
|
|
[[ -n "$PATH_ARG" && -f "$PATH_ARG" ]] || exit 0
|
|
|
|
python3 - <<'PY' "$PATH_ARG"
|
|
from pathlib import Path
|
|
import sys
|
|
|
|
for raw in Path(sys.argv[1]).read_text().splitlines():
|
|
s = raw.strip()
|
|
if not s or s.startswith('#') or '=' not in s:
|
|
continue
|
|
key, value = s.split('=', 1)
|
|
key = key.strip()
|
|
value = value.strip().strip('"').strip("'")
|
|
if not key or not value:
|
|
continue
|
|
print(f"{key}={value}")
|
|
PY
|