5 releases

0.0.5 Aug 23, 2024
0.0.4 Aug 23, 2024
0.0.3 Aug 22, 2024
0.0.2 May 7, 2024
0.0.1 Apr 17, 2020

#426 in Command line utilities

Download history 2/week @ 2024-07-27 252/week @ 2024-08-17 90/week @ 2024-08-24 1/week @ 2024-08-31 33/week @ 2024-09-14 12/week @ 2024-09-21 31/week @ 2024-09-28

76 downloads per month

MIT license

6KB
67 lines

retry (cli)

Summary

A small command line application that assists in retrying failed commands.

retry is a command line tool written in Rust intended to automatically re-run failed commands with a user configurable delay between tries.

Usage

Usage: retry [OPTIONS] <COMMAND>...

Arguments:
  <COMMAND>...


Options:
      --attempts <ATTEMPTS>
          [default: 3]

      --min-duration <MIN_DURATION>
          minimum duration

          Examples: `10ms`, `2s`, `5m 30s`, or `1h10m`

          [default: 10ms]

      --max-duration <MAX_DURATION>
          maximum duration

          Examples: `10ms`, `2s`, `5m 30s`, or `1h10m`

      --jitter <JITTER>
          amount of randomization to add to the backoff

          [default: 0.3]

      --factor <FACTOR>
          backoff factor

          [default: 2]

  -h, --help
          Print help (see a summary with '-h')

  -V, --version
          Print version

Installation

$ cargo install retry-cli

Examples

Working successfully:

$ retry echo hi
hi
$

The command fails to execute

$ retry cmd-does-not-exist
Error: "unable to execute: Os { code: 2, kind: NotFound, message: \"No such file or directory\" }"
$

The command executes, but fails

$ retry false
failed, retrying...
failed, retrying...
Error: "continued to fail after 3 attempts"
$

Dependencies

~1.2–1.8MB
~34K SLoC