4 ms·
What are some concrete use cases for this?
by dharmab 5y ago
What are some concrete use cases for this?
- iamjackg 5y agoIn 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.
- kqr 5y agoHave you tried Perl?
- iamjackg 5y agoI 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.
- tkiolp4 5y agoI usually use Ansible for that. Check it out!
- iamjackg 5y agoAnsible 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.
- mithun 5y agoLike `make`?
- dharmab 5y agomake 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`
- vageli 5y agoThe 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.
- dharmab 5y agoVery 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!
- dannyben 5y agoI 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/ https://bashly.dannyb.co/examples/