DEV Community

TekWizely
TekWizely

Posted on

Run v0.7.0 - Easily manage and invoke small scripts and wrappers

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 | Examples | Installing | 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"
Enter fullscreen mode Exit fullscreen mode

output

$ run test

Hello, World
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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

Enter fullscreen mode Exit fullscreen mode

output

$ mycmd version

mycmd v1.2.3

$ mycmd run-version

run v0.7.0
Enter fullscreen mode Exit fullscreen mode

Pre-Compiled Binaries Available

Thanks to a conversation with Athul Cyriac, I decided to give GoReleaser 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 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}
Enter fullscreen mode Exit fullscreen mode

output

$ run shell

sh
Enter fullscreen mode Exit fullscreen mode

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}
Enter fullscreen mode Exit fullscreen mode

output

$ run shell

sh
Enter fullscreen mode Exit fullscreen mode

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

Top comments (0)