Implement core script improvements
- Add joomla_manifest.sh library with manifest parsing functions - Add smoke_test.sh for repository validation - Add versions.sh for version management - Add JSON utilities to common.sh - Fix logging.sh with proper enhanced logging functions - Make all scripts executable Co-authored-by: jmiller-moko <230051081+jmiller-moko@users.noreply.github.com>
This commit is contained in:
27
scripts/lib/common.sh
Normal file → Executable file
27
scripts/lib/common.sh
Normal file → Executable file
@@ -102,6 +102,33 @@ normalize_path() {
|
||||
printf '%s\n' "$1" | sed 's|\\|/|g'
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# JSON utilities
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
json_escape() {
|
||||
require_cmd python3
|
||||
python3 -c 'import json,sys; print(json.dumps(sys.argv[1]))' "$1"
|
||||
}
|
||||
|
||||
json_output() {
|
||||
local status="$1"
|
||||
shift
|
||||
require_cmd python3
|
||||
python3 - <<PY "$status" "$@"
|
||||
import json
|
||||
import sys
|
||||
status = sys.argv[1]
|
||||
pairs = sys.argv[2:]
|
||||
data = {"status": status}
|
||||
for pair in pairs:
|
||||
if "=" in pair:
|
||||
k, v = pair.split("=", 1)
|
||||
data[k] = v
|
||||
print(json.dumps(data, ensure_ascii=False))
|
||||
PY
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Guardrails
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user