Skip to content
/ shmux Public

๐Ÿš Run multiple scripts from one file. In (almost) any language.

License

Notifications You must be signed in to change notification settings

shikaan/shmux

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

51 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

logo

shmux

Run multiple scripts from one file. In (almost) any language.

โšก๏ธ Quick start

Installation

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.

Usage

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.

Writing a recipe

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 a recipe

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

Recipe dependencies

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.

๐Ÿ“„ Documentation

More detailed documentation can be found here.

โ“ FAQs

  • Isn't this just another GNU Make?

    shmux draws inspiration from make 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.

๐Ÿค“ Contributing

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.

License

MIT