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.
A common use case for shmux
is running simple scripts in a standardized and language-agnostic way. These scripts are to be found in the configuration file, also known as 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"
Which can then be utilized 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
What if we wanted to write the scripts in JavaScript? Well, you then just need a shmuxfile.js
with a shebang defining the interpreter to be used and you're set.
greet:
#!/usr/bin/env node
const friend = "$1"
const author = "$@"
const message = friend === "darkness"
? "Hello darkness, my old friend"
: `Hello ${friend}, from ${author}`
console.log(message)
and run it like
$ shmux greet -- "Manuel"
# => Hello Manuel, from greet
More detailed documentation can be found here.
-
Which languages are supported?
shmux
makes no assumptions about the underlying scripting language to utilize, because it always requires you to specify the shell. Any language whose syntax is compatible with shmuxfiles' requirements is supported. -
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.