Includes; Overriding Commands; Easily Export Attributes; Mac Arm64 Binary - v0.9.0
About
Run is task runner that helps you easily manage and invoke small scripts and wrappers.
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.
What's Changed in v0.9.0
- feat: Add support for INCLUDE directive by @TekWizely in #46
- feat: Add support for overriding commands by @TekWizely in #51
- feat: Add .RUNFILE.DIR, .SELF, .SELF.DIR by @TekWizely in #55
- bug: Allow Dynamic Content in Simple Titles by @TekWizely in #59
- feat: Easily export attributes by @TekWizely in #60
Full Changelog: v0.8.0...v0.9.0
Mac ARM64 Binary
In addition to code changes, this release also introduces a darwin_arm64 binary in the pre-compiled assets.
Includes
Includes let you organize commands across multiple Runfiles.
Simple example:
file layout
Runfile
Runfile-hello
Runfile
INCLUDE Runfile-hello
Runfile-hello
hello:
echo "Hello from Runfile-hello"
output
$ run hello
Hello from Runfile-hello
Overriding Commands
This release now allows you override commands, as long as they were originally registered in a different Runfile.
Runfile
## defined in Runfile
command1:
echo command1 from Runfile
INCLUDE Runfile-include
## defined in Runfile
command2:
echo command2 from Runfile
Runfile-include
## defined in Runfile-include
command1:
echo command1 from Runfile-include
## defined in Runfile-include
command2:
echo command2 from Runfile-include
list commands
$ run list
Commands:
...
command1 defined in Runfile-include
command2 defined in Runfile
Notice that the included runfile overrides command1, but the primary runfile overrides command2.
.RUNFILE.DIR, .SELF, .SELF.DIR
This release includes a few extra attributes to help Runfiles know where they exist in the file system. In addition to already present .RUNFILE attribute, we now also have:
| Attribute | Description |
|---|---|
.RUNFILE |
Contains the absolute path of the primary Runfile. |
.RUNFILE.DIR |
Contains the absolute path of the parent folder of the primary runfile. |
.SELF |
Contains the absolute path of the current (primary or included) runfile. |
.SELF.DIR |
Contains the absolute path of the parent folder of the current runfile. |
Dynamic Content in Simple Titles
This release fixes a bug that now allows you to use dynamic data within simple one-line titles:
Runfile
EXPORT HELLO ?= "World"
## Prints "Hello, ${HELLO}"
hello:
echo Hello, ${HELLO}
usage
$ HELLO=Newman run help hello
hello:
Prints "Hello, Newman"
Easily Export Attributes
This release makes it easier to export attributes as variables for use in your own commands:
Simple Export
You can quickly export an attribute with a default variable name:
Runfile
EXPORT .RUNFILE, .RUNFILE.DIR
## Prints the value of .RUNFILE
runfile:
echo "${RUNFILE}"
## Prints the value of .RUNFILE.DIR
runfile-dir:
echo "${RUNFILE_DIR}"
With this technique, Run uses the attribute's name to determine the exported variable's name by:
- Removing the leading
.character - Substituting any remaining
.characters with_
Export With Name
If you want to export an attribute with a non-default variable name, you can use the AS syntax:
EXPORT .RUNFILE AS RF
EXPORT .RUNFILE.DIR AS RFD
## Prints the value of .RUNFILE
runfile:
echo "${RF}"
## Prints the value of .RUNFILE.DIR
runfile-dir:
echo "${RFD}"