Run multiple scripts from one file. In (almost) any language.
MacOS and Linux
sudo sh -c "curl -s https://shikaan.github.io/sup/install | REPO=shikaan/shmux sh -"
# or
sudo sh -c "wget -q https://shikaan.github.io/sup/install -O- | REPO=shikaan/shmux sh -"
Windows and manual instructions
Head to the releases page and download the executable for your system and architecture.
shmux
makes you execute different scripts in any scripting language from one one configuration file.
The scripts are called recipes and the configuration file is called shmuxfile.
For example, a shmuxfile.sh
for a Go project might look like:
test:
go test ./...
build:
go generate
GOOS=$1 go build
greet:
echo "Hello $1, my old friend"
echo:
echo "$@"
The last two recipes could be also written in JavaScript like:
greet:
#!/usr/bin/env node
const friend = "$1"
console.log(`Hello ${friend}, my old friend`)
echo:
#!/usr/bin/env node
console.log(`$@`)
Running the recipes then is as simple as:
# Runs the test command
$ shmux test
# Runs the build command with "linux" as $1
$ shmux build -- "linux"
# Runs the greet command with "darkness" as $1
$ shmux greet -- "darkness"
# => Hello darkness, my old friend
Similar to a Makefile
, recipes can have dependencies:
test:
go test ./...
build: test
go build
$ shmux build
Running shmux build
will execute test
before build
.
More detailed documentation can be found here.
-
Isn't this just another GNU Make?
shmux
draws inspiration frommake
but stands out as a script runner, not a build system. This distinction eliminates common build system constraints like the presumption that outputs are files. Moreover, it offers:- Command line arguments support.
- Compatibility with various scripting languages.
- Pre-runtime issue detection.
- Execution capability from any subdirectory.
- Native support on MacOS and Windows, no extra dependencies required.
-
Which languages are supported?
shmux
makes no assumptions about the underlying scripting language to utilize, because it always requires you to specify the shell (either via flag or shebang).To this day,
shmux
is known to be working with:- sh and derviatives (bash, dash, fish, zsh...)
- JavaScript / TypeScript (with ts-node)
- Perl
- Python
- Ruby
-
Does it have editor support?
As long as the language you choose is fine with having strings like
script:
in its syntax, you can just piggy-back on the existing editor support.For example, if your shmuxfile hosts JavaScript code, calling it
shmuxfile.js
will give you decent syntax highlighting out of the box in most editors.More sophisticated editor support may be coming soon. If you are interested, feel free to open an issue.
Have a look through existing Issues and Pull Requests that you could help with. If you'd like to request a feature or report a bug, please create a GitHub Issue.