#!/usr/bin/env nix-shell
#!nix-shell -i bash -p haskellPackages.cabal-install -p docker -p gh -p git -p glab -p mdbook -p taskwarrior
set -ex
rm -f conf/conf.gen.toml
echo "# generated by scripts/conf.sh" > conf/conf.gen.toml
# TODO: nix
go() {
  cargo run -qr -- -vvvv extract $1 conf/$1.toml > conf/$1.gen.toml || exit 1
  cat conf/$1.gen.toml >> conf/conf.gen.toml
}
for tool in cabal cargo docker gh git glab mdbook task tmux; do
  go "${tool}"
done
if [[ $OSTYPE != darwin* ]]; then
  go systemctl
fi
cp conf/conf.gen.toml conf/conf.toml
