tools/autoinstall/run_command.sh
Tobias Reisinger 5cc3d5144d
All checks were successful
/ build-artifacts (autoinstall) (push) Successful in 18s
/ build-artifacts (autostart-manage) (push) Successful in 16s
/ upload-release (push) Successful in 13s
Fix completions workflow
2024-01-12 02:40:58 +01:00

49 lines
1 KiB
Bash

#!/usr/bin/env bash
group=${args[group]:?}
clean=${args[--clean]:-}
_config_query() {
tomlq -c --arg group "$group" \
'.autoinstall | map(select(.group == $group)) | '"$1" \
"$XDG_CONFIG_HOME/autoinstall.toml"
}
#length=$(_config_query "length")
_config_query ".[]" | while read -r entry; do
install_args=()
type=$(echo "$entry" | jq -r '.type')
source=$(echo "$entry" | jq -r '.source')
target=$(echo "$entry" | jq -r '.target')
hook=$(echo "$entry" | jq -r '.hook // ""')
pipe=$(echo "$entry" | jq -r '.pipe // ""')
completions=$(echo "$entry" | jq -r '.completions // ""')
if [[ -n "$hook" ]]; then
install_args+=("--hook=$hook")
fi
if [[ -n "$clean" ]]; then
install_args+=("--clean")
fi
install_args+=("$type")
if [[ -n "$pipe" ]]; then
install_args+=("--pipe=$pipe")
fi
if [[ -n "$completions" ]]; then
install_args+=("--completions=$completions")
fi
if [[ $source = \$* ]]
then
source=$(eval "echo $source")
fi
install_args+=("$source")
install_args+=("$(eval "echo $target")")
autoinstall "${install_args[@]}"
done