1
0
mirror of https://github.com/Miserlou/Loop synced 2024-07-08 19:45:57 +00:00
Go to file
2018-05-18 12:15:19 -04:00
src formatting 2018-05-17 17:31:15 -04:00
.gitignore formatting 2018-05-17 17:31:15 -04:00
Cargo.toml update toml 2018-05-18 12:15:19 -04:00
README.md Initial functionality 2018-05-17 17:28:24 -04:00

loop

UNIX's missing loop command.

Why?

Loops in bash are surprisingly complicated and fickle! I wanted a simple way to write controllable loops. This is also my first Rust project.

Some examples:

$ loop ls 
./hello.txt
./hello.txt
./hello.txt
./hello.txt
[ .. ]

Counting by a value:

$ loop 'echo $COUNT' --count-by 5
0
4
9
14
[ .. ]

Timed loops:

$ loop 'date' --every 5s
Thu May 17 10:51:03 EDT 2018
Thu May 17 10:51:08 EDT 2018
Thu May 17 10:51:13 EDT 2018
[ .. ]

Limited loops:

$ loop 'ls' --num 2
./hello.txt
./hello.txt
$ 

Installation

Not published yet.

Building

cargo build
./debug/loop

Advanced Usage

Iterators can be floats!

$ loop 'echo $COUNT' --count-by 1.1
0
1.1
2.2
[ .. ]

There's also an $ACTUALCOUNT:

Iterators can be floats!

$ loop 'echo $COUNT $ACTUALCOUNT' --count-by 2
0 0
2 1
4 2
[ .. ]