News for hackers. Stuff that matters.
Re:Bashly – Create beautiful bash scripts from simple YAML c... by esoterae on Wednesday August 25, 2021 @04:02PM (#28306196)
Sooo.. it's a yaml-based bash DSL that manually cross-compiles back to .. bash?

It's probably clever, sure, but it seems like this would wind up more declarative than imperative?

Re:Bashly – Create beautiful bash scripts from simple YAML c... by dannyben on Wednesday August 25, 2021 @04:41PM (#28306655)
No. No DSL.

1. Define your commands + flags + args in YAML (`bashly init` creates this YAML).

2. Bashly generates the standalone script and empty "placeholder" scripts for your actual bash code (`bashly generate`).

3. You plug in your bash code.

4. Bashly merges it all back to the same single final script (`bashly generate`).

5. Rinse and repeat.

Re:Bashly – Create beautiful bash scripts from simple YAML c... by verdverm on Wednesday August 25, 2021 @04:56PM (#28306881)
The yaml schema is in essence a DSL. It has required terms that have a specific meaning, in this case specific to CLI UX.

What happens when I get to 5 and want to change an arg for cdm/foo? Does step 3 need to be repeated in its entirety?

Re:Bashly – Create beautiful bash scripts from simple YAML c... by dannyben on Wednesday August 25, 2021 @05:05PM (#28307001)
No need to repeat step 3. Code for each command (in case you want a bash script with subcommands), is placed in `src/<command_name>_command.sh`. Running `bashly generate` will always read it and re-merge it.

I think this is a good minimal example:

https://github.com/DannyBen/bashly/tree/master/examples/mini...