Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shikaan/shmux
🐚 Run multiple scripts from one file. In (almost) any language.
https://github.com/shikaan/shmux
bash cli go language makefile productivity scripts shell shell-script terminal
Last synced: about 2 months ago
JSON representation
🐚 Run multiple scripts from one file. In (almost) any language.
- Host: GitHub
- URL: https://github.com/shikaan/shmux
- Owner: shikaan
- License: mit
- Created: 2022-12-23T17:27:02.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-12-22T08:10:00.000Z (11 months ago)
- Last Synced: 2024-07-26T17:53:58.196Z (4 months ago)
- Topics: bash, cli, go, language, makefile, productivity, scripts, shell, shell-script, terminal
- Language: Go
- Homepage:
- Size: 45.9 KB
- Stars: 44
- Watchers: 2
- Forks: 2
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-make - shikaan/shmux
README
shmux
Run multiple scripts from one file. In (almost) any language.## ⚡️ Quick start
### Installation
_MacOS and Linux_
```sh
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](https://github.com/shikaan/shmux/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:
```sh
test:
go test ./...build:
go generate
GOOS=$1 go buildgreet:
echo "Hello $1, my old friend"echo:
echo "$@"
```The last two recipes could be also written in JavaScript like:
```js
greet:
#!/usr/bin/env nodeconst friend = "$1"
console.log(`Hello ${friend}, my old friend`)echo:
#!/usr/bin/env nodeconsole.log(`$@`)
```#### Running a recipe
Running the recipes then is as simple as:
```bash
# 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:
```sh
test:
go test ./...build: test
go build
``````bash
$ shmux build
```
Running `shmux build` will execute `test` before `build`.## 📄 Documentation
More detailed documentation can be found [here](./docs/docs.md).
## ❓ 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](https://github.com/shikaan/shmux/issues) and [Pull Requests](https://github.com/shikaan/shmux/pulls) that you could help with. If you'd like to request a feature or report a bug, please create a [GitHub Issue](https://github.com/shikaan/shmux/issues).
## License
[MIT](./LICENSE)