Sime makelike wrapper scripts support

Natanael Copa ncopa at alpinelinux.org
Mon Jan 13 13:18:20 UTC 2020


On Sun, 12 Jan 2020 00:10:09 +0100
Boris Kotov <bk at webdeb.de> wrote:

> Hello BusyBox community,
> 
> 
> my name is Boris, I would like to make a small feature request regarding 
> the `ash` shell.
> 
> It would be really handy to have a simple Makefile-like wrapper scripts 
> syntax just to execute some common commands on it:
> 
> 
> ```
> 
> hello:
> 
>     echo hello
> 
> build:
> 
>     docker build -t image .
> 
> push:
> 
>     docker push -t image
> 
> ```
> 
> 
> Right now, if you want to have that on alpine you would have to include 
> make, which is about 230kb!!
> 
> 
> Most people are doing this blackbox approach:
> 
> ```
> 
> scripts/
> 
>    hello.sh
> 
>    build.sh
> 
>    push.sh
> 
> ```

How about using shell functions instead:

```
#!/bin/sh -e

hello () {
	echo hello
}

build() {
	docker build -t image .
}

push() {
	docker push -t image
}

"$@"
```

If you call that minimake.sh, then you call it as:

```
./minimake.sh hello
./minimake.sh build
./minimake.sh push
```


> 
> 
> Blackbox, because its not clear what's in there, you have open each 
> file, then your whole terminal window or IDE fills an empty file with 
> one/two valuable lines.
> 
> However Makefile syntax is very nice, could we just include something 
> like `minimake` or called it (do) which only supports naming tasks?
> 
> I think this is such a basic feature, that every language has build its 
> own (mix, npm, rake, etc..)
> 
> Why not include it directly into the most minimal basic shell itself to 
> make our scripts simpler, and the world better.


> 
> 
> Thank you very much
> 
> Boris
> 
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox



More information about the busybox mailing list