Add some improvements
This commit is contained in:
parent
c5316e8318
commit
5dbdf3d311
4 changed files with 18 additions and 2 deletions
|
@ -30,6 +30,12 @@ commands:
|
||||||
- name: group
|
- name: group
|
||||||
required: true
|
required: true
|
||||||
help: The group to install
|
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
|
- name: git
|
||||||
help: Install a git repository
|
help: Install a git repository
|
||||||
|
|
|
@ -19,5 +19,12 @@ fi
|
||||||
if [ -n "$clean" ] || [ -n "${AUTOINSTALL_CLEAN:-}" ]
|
if [ -n "$clean" ] || [ -n "${AUTOINSTALL_CLEAN:-}" ]
|
||||||
then
|
then
|
||||||
echo "Cleaning $target"
|
echo "Cleaning $target"
|
||||||
|
|
||||||
|
# sanity checks
|
||||||
|
if [ -z "$target" ] || [ "$target" = "/" ] || [ "$target" = "$HOME" ] || [ "$target" = "$HOME/" ]
|
||||||
|
then
|
||||||
|
echo "Invalid target: '$target'"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
rm -rf "$target"
|
rm -rf "$target"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
group=${args[group]:?}
|
group=${args[group]:?}
|
||||||
|
file=${args[--file]:-}
|
||||||
clean=${args[--clean]:-}
|
clean=${args[--clean]:-}
|
||||||
|
|
||||||
_config_query() {
|
_config_query() {
|
||||||
tomlq -c --arg group "$group" \
|
tomlq -c --arg group "$group" \
|
||||||
'.autoinstall | map(select(.groups + ["all"] | contains([$group]))) | '"$1" \
|
'.autoinstall | map(select(.groups + ["all"] | contains([$group]))) | '"$1" \
|
||||||
"$XDG_CONFIG_HOME/autoinstall.toml"
|
"$file"
|
||||||
}
|
}
|
||||||
|
|
||||||
_config_query ".[]" | while read -r entry; do
|
_config_query ".[]" | while read -r entry; do
|
||||||
|
@ -43,5 +44,5 @@ _config_query ".[]" | while read -r entry; do
|
||||||
|
|
||||||
install_args+=("$(eval "echo $target")")
|
install_args+=("$(eval "echo $target")")
|
||||||
|
|
||||||
autoinstall "${install_args[@]}"
|
"$0" "${install_args[@]}"
|
||||||
done
|
done
|
||||||
|
|
2
run.sh
2
run.sh
|
@ -6,4 +6,6 @@ target=$(cat .target)
|
||||||
|
|
||||||
make generate
|
make generate
|
||||||
|
|
||||||
|
printf "\nBuild complete. Running...\n==========================\n\n"
|
||||||
|
|
||||||
"./output/$target" "$@"
|
"./output/$target" "$@"
|
||||||
|
|
Loading…
Reference in a new issue