Tired of managing a bunch of shell scrips and modifying copy-pasted from a text file long command lines before running them, I decided to make my life easier. The first obvious choice was 'make'. But it appeared that some tasks were too hard or impossible to implement using makefiles, e.g, run a certain recipe for one arbitrary file in a directory. I kept looking for the tool. Next, I found "just" - another command runner written in Rust. It was a good tool but there were some things I did not like: python-like indentation requirements, lack of built-in function(e.g, to modify a file path), and basic Windows support. It made me to start writing my own command runner with optional indentation, Rust-like attributes for recipes, a rich set of built-in functions and control flow statements. That allowed me to write scripts in cross-platfom way without requiring additional interpreters. Honestly, I borrowed few features from
just: e.g, doc comments and recipe arguments rules. You can see "just" here https://github.com/casey/just
Here is a very short example of a hakufile that executes the most appropriate make call depending on OS:
#[os(windows)] build: make -f mingw.makefile build #[os(linux)] build: make build`
Run the command "haku build myproject" on Windows, and it builds the project with MinGW toolset(if it has been installed beforehand).
Please note that it is not "make" replacement because it does optimize building time and does not have built-in rules for processing a file by its extension. . It just runs a set of commands(a.k.a a recipe) by its name. Haku recipes are close to makefile ones that are listed in