News for hackers. Stuff that matters.
Re:Bashly – Create beautiful bash scripts from simple YAML c... by dharmab on Wednesday August 25, 2021 @03:29PM (#28305833)
What are some concrete use cases for this?
Re:Bashly – Create beautiful bash scripts from simple YAML c... by dannyben on Wednesday August 25, 2021 @04:45PM (#28306721)
I created bashly to support a simple use case:

When you want to create a bash script - and you choose bash for portability or for whatever reason - and still want to have a decent-looking command line interface, without investing effort in creating argument parsers and usage help.

The examples page shows real-world examples, and per-feature examples: https://bashly.dannyb.co/examples/

Re:Bashly – Create beautiful bash scripts from simple YAML c... by iamjackg on Wednesday August 25, 2021 @03:33PM (#28305881)
In my case, I used it to build an all-in-one tool for a local dev environment. It wraps all kinds of operations for starting/stopping things, extracting and modifying data, etc. while providing some useful tips when things go wrong.

At its core it's just interacting with existing software like docker-compose, git, and some internal tools, which I find is still much, much easier to do with shell scripting than "proper" languages.

Re:Bashly – Create beautiful bash scripts from simple YAML c... by dharmab on Wednesday August 25, 2021 @04:44PM (#28306701)
Very neat. I have written custom Ruby scripts for this kind of thing in the past. There's also an `sh` library for Python that makes it easier to call external commands inline, although it has some issues in non-trivial cases. Thanks for sharing!
Re:Bashly – Create beautiful bash scripts from simple YAML c... by tkiolp4 on Wednesday August 25, 2021 @04:02PM (#28306202)
I usually use Ansible for that. Check it out!
Re:Bashly – Create beautiful bash scripts from simple YAML c... by iamjackg on Wednesday August 25, 2021 @04:13PM (#28306331)
Ansible is awesome, but would largely be overkill for something like this. I'm not doing much more than ensuring a few things are in place, merging a couple files, and then running docker-compose up/down, or exec-ing into running containers to run commands. I certainly wouldn't want people to have to run an entire playbook just to do all this: it's slow, requires even more setup, and is not really well suited for quick CLI-like use.
Re:Bashly – Create beautiful bash scripts from simple YAML c... by mithun on Wednesday August 25, 2021 @04:04PM (#28306224)
Like `make`?
Re:Bashly – Create beautiful bash scripts from simple YAML c... by vageli on Wednesday August 25, 2021 @04:49PM (#28306771)
The parent's use case is exactly what I use make for, with the added benefit that it is already available on developer machines in my org.
Re:Bashly – Create beautiful bash scripts from simple YAML c... by dharmab on Wednesday August 25, 2021 @04:42PM (#28306678)
make is powerful, but it has some weaknesses. The syntax and macros are complicated to parse and troubleshoot. There are some common gotchas like .PHONY and indentation.

There are of course other alternatives such as `doit`

Re:Bashly – Create beautiful bash scripts from simple YAML c... by kqr on Wednesday August 25, 2021 @03:36PM (#28305906)
Have you tried Perl?
Re:Bashly – Create beautiful bash scripts from simple YAML c... by iamjackg on Wednesday August 25, 2021 @03:41PM (#28305968)
I have, and I quite like it! That doesn't seem to be the way most people feel about it though.

I need to build things that pass the bus audit: other people also have to understand them and work on them and, for better or for worse, Bash is a very popular lowest common denominator for many devs.