-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Hi, thank you for this crate.
It's appalling we all now have to use TOML (a Toxic Oligarchic Mechanistic Lock-in) just like JavaScript. Try scripting edits. See? "Designed to be written by humans." Config formats should never impose this limitation! You can't even wrap lines! Some people love that complexity, but your tool makes it more bearable for me. I want to use my brain for programming in Rust, not for editing config files and 1970s bash scripts!
direnv is the straw that broke the camel's back. Have to grant it permission on every folder over and over. Not anymore.
cringeworthy justfile:
setup-direnv:
# ...
echo "Setting up direnv config..."
PREFIX="$HOME/apps"
tomato -f toml set global.load_dotenv true $CONFIG_FILE
# monstrosity that should not exist: add value if not exists
existing=$(tomato get whitelist.prefix $CONFIG_FILE)
if [ -n "$existing" ]; then
echo "looking for $PREFIX..."
while IFS= read -r path; do
echo "path: $path"
if [[ "$path" == "$PREFIX" ]]; then
exit 0
fi
done <<< "$existing"
echo "Existing whitelist.prefix missing PREFIX: $existing"
else
echo "No existing whitelist.prefix found, setting up..."
fi
tomato -f toml append whitelist.prefix "$PREFIX" $CONFIG_FILEWould be wonderful to replace with:
better justfile:
setup-direnv:
# ...
echo "Setting up direnv config..."
PREFIX="$HOME/apps"
tomato -f toml set global.load_dotenv true $CONFIG_FILE
tomato -f toml append --unique whitelist.prefix "$PREFIX" $CONFIG_FILEIs it achievable?
Again, thanks. I could just write a string, but multiline strings in justfiles are awful. I wanted an idiomatic, rust-like solution. You've provided it, it's 90% there.
P.S. Why isn't tomato a standard Cargo tool? We're all forced to use TOML, so why don't the rustlang maintainers provide a built-in tool since it's required? We have to use it, no choice. All the abandoned tq utils on crates.io are telling of a need.