mirror of
https://github.com/dredx/prole.git
synced 2026-09-23 11:03:59 +00:00
Shell library (mock_val/lib/shell/):
- Delete prole_cmd.sh, prole_env.sh, prole_guardrails.sh,
prole_secrets.sh, prole_string.sh, prole_yaml.sh
- Add knoe_* equivalents with same functionality
Config tooling:
- Delete mock_val/prole_cfg.sh, mock_val/sync-prole-cfg.py
- Add mock_val/knoe_cfg.sh, mock_val/sync-knoe-cfg.py
Mirrors the broader prole → knoe project rename.
Co-authored-by: Junie <junie@jetbrains.com>
19 lines
417 B
Bash
19 lines
417 B
Bash
#!/usr/bin/env bash
|
|
|
|
# Extract a simple scalar `key: value` from a YAML file.
|
|
# - Intended for flat `group_vars` style YAML only (no nesting).
|
|
# - Strips surrounding quotes.
|
|
knoe_yaml_get_scalar() {
|
|
local file="$1"
|
|
local key="$2"
|
|
|
|
awk -F: -v k="$key" '
|
|
$0 ~ "^[[:space:]]*"k"[[:space:]]*:" {
|
|
sub(/^[^:]+:[[:space:]]*/, "", $0);
|
|
gsub(/\"/, "", $0);
|
|
print $0;
|
|
exit
|
|
}
|
|
' "$file"
|
|
}
|