2016-01-01 21:12:40 +00:00
wait(1) -- Run commands and wait with a spin
============================================
## SYNOPSIS
`wait` *commands* [`--spin`=*arc*|*star*|*pipe*|*ball*|*flip*|*mixer*|*caret*|*bar1~3*]< br >
`wait` *commands* [`--time`=interval] [`--log`=file] [`--format`=format] [`--help`]
## DESCRIPTION
Run *commands* as a background process and wait until the job has finished. Any output to standard error indicates `wait` to return `1` once is done. While it waits, a customizable spinner is displayed in the command line.
## OPTIONS
2016-01-10 07:01:07 +00:00
* `-s --spin=style|string` :
Set spinner style. See `Styles` for a list of styles and instructions on how to use your own character sequences, progress bar usage, etc.
2016-01-01 21:12:40 +00:00
2016-01-10 07:01:07 +00:00
* `-t --time=interval` :
2016-01-01 21:12:40 +00:00
Set spinner transition time delay in *seconds* . A large value will refresh the spinner more slowly. You may use decimal numbers to represent smaller numbers.
2016-01-10 07:01:07 +00:00
* `-l --log=file` :
2016-01-01 21:12:40 +00:00
Output standard error to given *file* .
2016-01-10 07:01:07 +00:00
* `-f --format=format` :
2016-01-01 21:12:40 +00:00
Use given *format* to display the spinner. The default format is `"\r@"` where `@` represents the spinner token and `\r` a carriage return, used to refresh / erase the line.
2016-01-10 07:01:07 +00:00
* `-h --help` :
2016-01-01 21:12:40 +00:00
Show usage help.
## STYLES
2016-01-10 07:01:07 +00:00
The following styles are supported via `--spin=style` :
2016-01-01 21:12:40 +00:00
* arc, star, pipe, ball, flip, mixer, caret
* bar1~3
### CUSTOMIZATION
In addition to the default styles, you can specify a string of character tokens to be used each per spinner refresh cycle.
For example `--spin=12345` will display the numbers from 1 to 5, and `--spin=. --format=@` an increasing sequence of dots.
### PROGRESS BARS
2016-01-10 07:01:07 +00:00
Display a progress bar with a percent indicator using `--spin=bar1~3` :
2016-01-01 21:12:40 +00:00
* bar1: [=====] *num* %
* bar2: [#####] *num* %
* bar3: ....... *num* %
You can customize the appearance as follows:
```
--spin=bar:< opening token > < fill token > < empty slot token > < closing token > [%]
```
For example:
```
--spin="bar:[+-]%"
--spin="bar:(@o)"
--spin="bar:||_|"
```
## EXAMPLES
Run a lengthy operation as a background job and display a spinning pipe character until it is finished.
```
2016-01-10 07:01:07 +00:00
wait --spin=pipe "curl -sS $URL"
2016-01-01 21:12:40 +00:00
```
Output any errors to *debug.txt* .
```
2016-01-10 07:01:07 +00:00
if not wait --spin=pipe --log=debug.txt "curl -sS $URL"
2016-01-01 21:12:40 +00:00
return 1
end
```
## SEE ALSO
2016-01-10 07:01:07 +00:00
sleep(1)< br >