Add some improvements

This commit is contained in:
Tobias Reisinger 2024-03-22 22:14:13 +01:00
parent c5316e8318
commit 5dbdf3d311
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
4 changed files with 18 additions and 2 deletions

View file

@ -30,6 +30,12 @@ commands:
- name: group
required: true
help: The group to install
flags:
- long: --file
short: -f
help: File from which to read autoinstall-config
arg: file
default: $XDG_CONFIG_HOME/autoinstall.toml
- name: git
help: Install a git repository

View file

@ -19,5 +19,12 @@ fi
if [ -n "$clean" ] || [ -n "${AUTOINSTALL_CLEAN:-}" ]
then
echo "Cleaning $target"
# sanity checks
if [ -z "$target" ] || [ "$target" = "/" ] || [ "$target" = "$HOME" ] || [ "$target" = "$HOME/" ]
then
echo "Invalid target: '$target'"
exit 1
fi
rm -rf "$target"
fi

View file

@ -1,12 +1,13 @@
#!/usr/bin/env bash
group=${args[group]:?}
file=${args[--file]:-}
clean=${args[--clean]:-}
_config_query() {
tomlq -c --arg group "$group" \
'.autoinstall | map(select(.groups + ["all"] | contains([$group]))) | '"$1" \
"$XDG_CONFIG_HOME/autoinstall.toml"
"$file"
}
_config_query ".[]" | while read -r entry; do
@ -43,5 +44,5 @@ _config_query ".[]" | while read -r entry; do
install_args+=("$(eval "echo $target")")
autoinstall "${install_args[@]}"
"$0" "${install_args[@]}"
done

2
run.sh
View file

@ -6,4 +6,6 @@ target=$(cat .target)
make generate
printf "\nBuild complete. Running...\n==========================\n\n"
"./output/$target" "$@"