#docker-compose #command #logs #terminal #multiple #single #tool

app shunt

Run multiple commands in single terminal with docker compose like logs

4 releases (breaking)

0.4.0 Feb 24, 2023
0.3.0 Feb 19, 2023
0.2.0 Feb 19, 2023
0.1.0 Feb 19, 2023

#885 in Unix APIs

MIT/Apache

10MB
177K SLoC

Python 176K SLoC // 0.2% comments Rust 258 SLoC // 0.0% comments PowerShell 104 SLoC // 0.5% comments Shell 31 SLoC // 0.2% comments Forge Config 3 SLoC

Contains (Python package, 475KB) setuptools-44.1.1-py2.py3-none-any.whl, (Python package, 315KB) pip-20.3.4-py2.py3-none-any.whl, (Python package, 165KB) certifi-2020.6.20-py2.py3-none-any.whl, (Python package, 175KB) chardet-4.0.0-py2.py3-none-any.whl, (Python package, 150KB) distlib-0.3.1-py2.py3-none-any.whl, (Python package, 135KB) urllib3-1.26.5-py2.py3-none-any.whl and 33 more.

Shunt

Have you ever wanted to run multiple commands in the same terminal, and have Docker Compose style logs come out? Then this is the tool for you.

Configure the commands you want in a JSON (actually JSON5) file:

// dev.json
{
  commands: {
    ui: ["npm", "run", "dev"],
    backend: ["cargo", "run"],
  },
}

Run shunt dev.json and see your output neatly woven together similar to Docker Compose.

Workdir

You can set the working directory that the command will run in, relative paths are relative to the JSON config.

{
  "commands": {
    "ui": {
      "argv": ["npm", "run", "dev"],
      "workdir": "frontend"
    }
  }
}

Pseudo-TTY

Each command is run in a pseudo-TTY if shunt itself is run in a pseudo-TTY. You can disable this with the tty option on a command:

{
  "commands": {
    "example-command": {
      "argv": "./build.sh",
      "tty": "never"
    }
  }
}

tty can be auto, never, or always.

Environment substitution

Environment substitution is not supported, you can add this support by calling out to a shell:

{
  commands: {
    something: ["bash", "-c", "echo $PATH"],
  },
}

TODO

  • Properly lock stdout in order to remove any chance of tearing.
  • Add global option for colored prefixes (this wouldn't stop color from children).
  • argv splitting option, eg just provide "echo hello".
  • (maybe) be able to send input.

Dependencies

~5–13MB
~155K SLoC