shunt

Crates.ioshunt
lib.rsshunt
version0.4.0
sourcesrc
created_at2023-02-19 19:40:32.469054
updated_at2023-02-24 22:10:46.803535
descriptionRun multiple commands in single terminal with docker compose like logs.
homepage
repository
max_upload_size
id789234
size20,662,095
Owen Gage (owengage)

documentation

README

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.
Commit count: 0

cargo fmt