Skip to content
ShaneIsleyPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Dozr: A flexible sleep-like command-line utility

Latest Version License

dozr extends the standard sleep command. It pauses execution for a fixed duration, until a specific time of day, or for a duration sampled from a statistical distribution.

Features

  • Simple Duration Waits: Pause for a fixed duration (e.g., 5s, 100ms).
  • Distribution-Based Waits: Pause for a duration sampled from a variety of statistical distributions, including:
    • Normal
    • Exponential
    • Log-Normal
    • Pareto
    • Uniform
    • Triangular
    • Gamma
  • Time-Based Waits: Pause until a specific time of day (e.g., 22:30:00).
  • Alignment: Align the wait to the next even interval (e.g., 1m, 30s).
  • Jitter: Add a random duration of jitter to the wait.
  • Probabilistic Waits: Wait only with a certain probability.
  • Verbose Output: Display a progress bar with the time remaining.

Installation

Install dozr from crates.io using cargo:

cargo install dozr

Usage

dozr is a flexible replacement for the standard sleep command.

dozr vs. sleep

sleep takes a single duration argument (e.g., sleep 5). The table below highlights key differences:

Feature sleep dozr
Basic Duration sleep 5 (seconds only) dozr d 5s (supports s, ms, m, h, etc.)
Distribution-based No Yes (Normal, Exponential, Log-Normal, Pareto, Uniform, Triangular, Gamma)
Time-based Wait No Yes (dozr at 22:30)
Alignment No Yes (dozr a 1m)
Jitter No Yes (dozr d 10s -j 1s)
Probabilistic Wait No Yes (dozr d 30s -p 0.5)
Verbose Output No Yes (dozr d 10s -v)

Basic Usage

Wait for a fixed duration:

# Wait for 5 seconds
dozr d 5s

Distribution-Based Waits

Sample a wait from a Normal distribution with a mean of 10 seconds and a standard deviation of 2 seconds:

# Wait for a duration sampled from a Normal distribution
dozr n 10s 2

Time-Based Waits

Wait until 10:30 PM:

# Wait until 10:30 PM
dozr at 22:30

Other Options

Add up to 1 second of random jitter to a 10-second wait:

# Wait for 10 seconds with up to 1 second of jitter
dozr d 10s -j 1s

Wait 30 seconds with a 50% chance of waiting:

# Wait for 30 seconds with a 50% probability
dozr d 30s -p 0.5

Display a progress bar while waiting:

# Wait for 10 seconds with a progress bar
dozr d 10s -v

Command-Line Arguments

Main Commands

Full Command Alias(es) Arguments Example
duration d <TIME> dozr d 5s
normal n <MEAN> <STD_DEV> dozr n 10s 2.5
exponential e <LAMBDA> dozr e 0.5
log-normal ln <MEAN> <STD_DEV> dozr ln 1s 0.5
pareto par <SCALE> <SHAPE> dozr par 1.0 2.0
uniform u <MIN> <MAX> dozr u 1s 10s
triangular t <MIN> <MAX> <MODE> dozr t 0.0 10.0 5.0
gamma g <SHAPE> <SCALE> dozr g 2.0 1.5
align a, ali <INTERVAL> dozr a 1m
at (none) <HH:MM[:SS]> dozr at 22:30

Global Options

Full Option Short Value Description
--jitter -j <TIME> Adds a random amount of time up to <TIME>. Not applicable to align or at.
--probability -p <FLOAT> The chance (0.0 to 1.0) that the wait will actually occur.
--verbose -v [TIME] Shows progress. Can take an optional update interval (e.g., -v 1s).
--help -h (none) Displays the help message for the command.
--version -V (none) Displays the application version.

License

dozr is licensed under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages