Run v0.7.0 - Easily manage and invoke small scripts and wrappers
Tags: showdev, go, tools
Published: 2020-01-10 17:25:34

## About

Do you find yourself using tools like make to manage non build-related scripts?

Build tools are great, but they are not optimized for general script management.

Run aims to be better at managing small scripts and wrappers, while incorporating a familiar make-like syntax.

Quick Links: [Project Page ](https://github.com/TekWizely/run) | [Examples](https://github.com/TekWizely/run#examples) | [Installing](https://github.com/TekWizely/run#installing) | [Releases](https://github.com/TekWizely/run/releases)

---

## Project Update - v0.7.0
Its been a couple of weeks since the last release and I wanted give an update on recent changes.

You can read about the new features and bug fixes below.

If you've been following run, I hope you'll find these updates useful.

If this your first time reading about run, and if you're at all interested in managing task runners and scripts, I hope you will give my project a try.

I am happy to answer any questions you might have.

Thank you,

-TekWizely

---

## Features

### Invoking Other Run Commands From Within Your Script

This version adds `.RUN` and `.RUNFILE` attributes to make it easier to invoke other commands (or runfiles) from within your command script.

Here's an example:

_Runfile_
```
##
# Invokes hello
# EXPORT RUN := ${.RUN}
# EXPORT RUNFILE := ${.RUNFILE}
test:
    "${RUN}" -r "${RUNFILE}" hello

hello:
    echo "Hello, World"
```

_output_
```
$ run test

Hello, World
```

We invoke the `test` command, which in turn invokes the `hello` command, which then prints `"Hello, World"`


### Let Runfile Define Its Own Version Command

In standard mode, run defines a `version` command to display its version info:


_Std Runfile example_
```
$ run version

run v0.7.0
```

In `shebang` mode, where run's goal is to keep the focus on the runfile and less on itself, the built-in `version` command is renamed to `run-version`

This allows the runfile to define its own `version` command:

_Shebang example ( 'mycmd' )_
```
#!/usr/bin/env run shebang

version:
	echo mycmd v1.2.3

```

_output_
```
$ mycmd version

mycmd v1.2.3

$ mycmd run-version

run v0.7.0
```

### Pre-Compiled Binaries Available
Thanks to a conversation with [Athul Cyriac](https://dev.to/athulcajay), I decided to give [GoReleaser](https://goreleaser.com/) a try.

And it worked !

Its not fully automated (yet) but it generates binaries, checksums and change logs.

Currently, 64-bit Linux and Darwin (Mac) binaries are generated, but I'm open to adding others.

You can find them on the [Releases](https://github.com/TekWizely/run/releases) page.

## Bug Fixes

### Reading .SHELL Attribute

You could always set the default shell via the `.SHELL` attribute, but now you can even READ the value!

_Runfile_
```
export MYSHELL := ${.SHELL}

shell:
   echo ${MYSHELL}
```

_output_
```
$ run shell

sh
```

### Exporting Attributes Within Command Description

Thanks to fixing an out-of-order bug, attributes are now available within command export statements:

_Runfile_
```
##
# My command
# export MYSHELL := ${.SHELL}
shell:
  echo ${MYSHELL}
```

_output_
```
$ run shell

sh
```

Of course this feature was given away in the `"Invoking Other Run Commands"` section above, but I wanted to call out the bug fix.