GitHub | crates.io | Issues | Changelog
elapsed is a simple utility program that runs a given command and, while
it's running, displays & updates the elapsed time below the command's output.
In order to install elapsed, you first need to have Rust and Cargo
installed. You can then build the
latest release of elapsed and install it in ~/.cargo/bin by running:
cargo install elapsed-cmd
(Note that the name of the package on crates.io is "elapsed-cmd"; just "elapsed" was already taken.)
elapsed [<options>] <command> [<arg> ...]
elapsed takes the name of a command to run plus any arguments to that
command. While the command is running, the elapsed time is displayed in a
status line written to standard error below the command's output and updated
once per second. If elapsed's standard error is redirected, the status line
will not be shown.
When the command exits, the status line is erased (unless the -t/--total
option was given), and elapsed exits with the same return code as the
command; if the command was killed by a signal, a message is printed to stderr
(after any --total status line), and elapsed exits with return code 1
instead.
-
-f <TEMPLATE>,--format <TEMPLATE>— Use the given format template for rendering the time in the status line. Templates may contain the following specifiers & escape sequences:%H- number of hours as a two-digit number%M- number of minutes within the hour as a two-digit number%S- number of seconds within the minute as a two-digit number%s- total number of seconds%f- subseconds; defaults to six digits (microseconds) but can also take a decimal precision (e.g.,%9fto show nanoseconds)%nor\n- newline%tor\t- tab%eor\e- escape character%%- percent sign\\- backslash
The default template is "
Elapsed: %H:%M:%S." -
-r <INT>,--refresh <INT>— Update the status line after every<INT>milliseconds [default: 1000 (once per second)] -
-t,--total— Leave the total elapsed time behind after the command finishes -
-T,--tty— Run the command via a pseudo-terminal. This is useful if the command's behavior (e.g., whether it buffers output or emits ANSI color sequences) changes depending on whether it's directly connected to a terminal.This option is only available on Unix.
-
-S,--split-stderr— When the--ttyoption is given, by default, the command's stdout and stderr will be merged together into a single stream that is ultimately printed onelapsed's stdout. If--split-stderris given, the command's stderr will not be connected to the pseudo-terminal and will instead be sent toelapsed's stderr so that stdout & stderr can then be redirected separately.This option is only available on Unix and only has an effect when
--ttyis also given. -
-h,--help— Show command-line usage -
-V,--version— Show current program version
elapsed is intended for use with commands with line-oriented output. If it
is used with a command that outputs a large amount of data between newlines or
that manipulates the cursor, you'll have a bad experience.
