#shell #command #task-runner #concurrently #command-name #command-line #parallel

app rly

Run shell commands concurrently with ease. Currently only a CLI tool.

2 unstable releases

0.2.0 Jan 18, 2023
0.1.0 Jan 9, 2023

#419 in Concurrency

Apache-2.0

32KB
564 lines

r[un concurrent]ly

Build Status license Version info

rly is a concurrent task runner and, in its current form, essentially a clone of concurrently. For example:

$ rly --names "server,client" \
      --kill-others \
      "nc -lk 1234" \
      "echo 'message from client' | nc localhost 1234"
[server] message from client
[client] echo 'message from client' | nc localhost 1234 exited with exit status: 0
--> Sending SIGKILL to other processes..
[server] nc -lk 1234 exited with signal: 9 (SIGKILL)

Installation

Currently you need to have rust installed in order to install rly:

cargo install rly

Usage (in progress)

Usage: rly [OPTIONS] [COMMANDS]...

Arguments:
  [COMMANDS]...


Options:
  -n, --names <NAMES>
          List of custom names to be used in prefix template.

          Example names: "main,browser,server"

      --name-separator <NAME_SEPARATOR>
          The character to split <names> on.

          Example usage: -n "styles|scripts|server" --name-separator
          "|"

          [default: ,]

  -r, --raw
          Output only raw output of processes, disables prettifying
          and concurrently coloring

      --no-color
          Disables colors from logging

      --hide <HIDE>
          Comma-separated list of processes for which to hide the
          output. The processes can be identified by their name or
          index

  -g, --group
          Order the output as if the commands were run sequentially

      --timings
          Show timing information for all processes

  -P, --passthrough-arguments
          Passthrough additional arguments to commands (accessible via
          placeholders) instead of treating them as commands

  -p, --prefix <PREFIX>
          Prefix used in logging for each process. Possible values:
          index, pid, time, command, name, none, or a template.
          Example template: "{time}-{pid}"

          [default: [{name}]]

  -c, --prefix-colors <PREFIX_COLORS>
          Comma-separated list of chalk colors to use on prefixes. If
          there are more commands than colors, the last color will be
          repeated.

          - Available modifiers: reset, bold, dim, italic, underline,
          inverse, hidden, strikethrough

          - Available colors: black, red, green, yellow, blue,
          magenta, cyan, white, gray, any hex values for colors (e.g.
          #23de43) or auto for an automatically picked color

          - Available background colors: bgBlack, bgRed, bgGreen,
          bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite

          See https://www.npmjs.com/package/chalk for more
          information.

          [default: reset]

  -l, --prefix-length <PREFIX_LENGTH>
          Limit how many characters of the command is displayed in
          prefix. The option can be used to shorten the prefix when it
          is set to "command"

          [default: 10]

  -t, --timestamp-format <TIMESTAMP_FORMAT>
          Specify the timestamp in chrono::format syntax

          [default: "%Y-%m-%d %H:%M:%S.%3f"]

  -k, --kill-others
          Kill other processes if one exits or dies

      --kill-others-on-fail
          Kill other processes if one exits with non zero status code

      --restart-tries <RESTART_TRIES>
          How many times a process that died should restart. Negative
          numbers will make the process restart forever

          [default: 0]

      --restart-after <RESTART_AFTER>
          Delay time to respawn the process, in milliseconds

          [default: 0]

  -h, --help
          Print help information (use `-h` for a summary)

  -V, --version
          Print version information

Why?

I like the UX of concurrently, but dislike having to install NodeJS / npm to use it. My goal is to make rly accessible via Homebrew (and potentially other package managers), so that installation only requires downloading a single binary.

Progress implementing concurrently features

  • commands can be supplied
  • --names can be passed
  • --name-separator
  • --raw
  • --no-color
  • --hide
  • --group
  • --timings
  • --passthrough-arguments
  • --prefix
    • index
    • pid
    • time
    • command
    • name
  • --prefix-colors
  • --prefix-length
  • --timestamp-format
  • --kill-others
  • --kill-others-on-fail
  • --restart-tries
  • --restart-after

License

See LICENSE file.

Dependencies

~9–23MB
~300K SLoC