Sime makelike wrapper scripts support

Natanael Copa ncopa at alpinelinux.org
Tue Jan 14 07:40:14 UTC 2020


On Mon, 13 Jan 2020 16:03:21 +0100
Boris Kotov <bk at webdeb.de> wrote:

> > 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
> > ```  
> 
> 
> Hallo Natanael Copa, thank you for your attention to this topic!
> 
> Sure, you can write shell scripts, functions, case-statements, but with 
> `mim` you eliminate unnecessary noise.

It solves the problem you called "blackbox approach". You no longer
need to open multiple small files.

> For example in the script above there are 5 Lines of 11 which do not 
> provide any value, but noise.

The noise provides value, because it makes it crystal clear what is
happening "under the hood".

> (like "$@" from the bottom of your script, 
> https://stackoverflow.com/questions/9994295/what-does-mean-in-a-shell-script 
> <https://stackoverflow.com/questions/9994295/what-does-mean-in-a-shell-script> 
> (174k views))

Its only POSIX shell syntax. You'd still need to learn that, regardless
if you use make or not. With make you need to learn both make syntax
*and* shell syntax, because make will execute a shell for each line.

> So, the USP here is that mim provides a very clear and intuitive 
> interface for non-experienced shell users

Its not that intuitive, even for tiny examples

--- Mimfile -------------------
hello:
	false; echo "will this echo or not?"

hello2:
	false
	echo "will this echo or not?"

-------------------------

and what about variables and variable expansion?


--- Mimfile ---------------------

last="1.0"

hello:
	echo "Last version is $(last)"

----------------------------------

What should happen? GNU make and shell handles that different.

In both those cases both experienced and non-experienced users would
need to verify the documentation.


> And for complex stuff, use mim as a wrapper and write shell scripts 
> underneath.

I though the problem mim was supposed to solve was to avoid write
wrapper scripts?

> 
> ```
> 
> deploy:
> 
>    scripts/deploy.sh
> 
> cleanup:
> 
>    rm -rf ./dist
> 
> ```
> 
> 
> I really would love to have it in busybox/alpine and in their 
> descendants, if you have common tasks to use in your containers, just 
> COPY a Mimfile in there.
> 
> ```
> 
> # postgres-container/WORKDIR/Mimfile
> 
> backup:
> 
>    # make a backup, post to s3
> 
> restore:
> 
>    # get from s3 & restore
> 
> ```

So basically, you want a new shell language only to avoid writing '()
{}' when declaring functions.

> 
> 
> ```
> 
> $ docker exec container mim restore
> 
> ```
> 
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox



More information about the busybox mailing list