Hi,
At my company I popularized the use of Makefiles to run simple chunks of commands repeatedly. We have make commands like reset-all
that will clean, purge the database, run some fixtures. We have lint
that will lint the javascript sub-app, the PHP/Elixir/Other main app, run a formatter, etc.
The problem is that we do not really know make, and not really use it. We just need to reference a group of commands with a single alias because we will always run those commands together, in the same order. And we can compose aliases in higher-order aliases (some_alias: other1 other2\n mix format
).
Plus, using variables, environment variables and arguments can be confusing with make, notably when you do not know it and you think it is “just bash”.
Why do we use it ? Because make is available on any OS, you put all your commands in a single file, you can (cd ... ; and do stuff elsewhere)
, you can install autocompletion easily, and it just works.
For example, a replacement would be to have a bash script that registers functions. But you would have to “run” the bash script to define those functions before you can use them. And as long as you do not close the session, those functions will stick around. With make, the aliases are only available where they make sense, i.e. the app root directory.
But I feel we are abusing make, and as I said, the bashy-but-not-bash syntax makes it hard to write advanced bash constructs.
So, do you know any other tool that packs the aforementioned features, but beeing more “just bash” ? Also, make does not stop if one of the command fails sometimes.
Thank you