# madbot_cli.progress

*module*

Show what a command is doing while it runs.

In a terminal, one line says the step under way and is written again in place
while madbot works in the background (``madbot reads the data: 2/4, 35 s``).
Elsewhere (a file, a CI log), each step is one line, a wait writes a new line
only when what it says changes, and no control character is written.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/progress.py#L1-1)

## madbot_cli.progress.CLEAR_LINE

*attribute* · *module attribute*

```python
CLEAR_LINE = '\r\x1b[2K'
```

Takes the cursor back to the start of the line and erases it, in a terminal.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/progress.py#L17-17)

## madbot_cli.progress.Progress

*class*

```python
class Progress
```

The step under way, and the lines a command writes around it.

**Parameters**

- `stream` (`TextIO`) — Where to write.
- `steps` (`bool`) (default: `True`) — Say the steps; False (``--quiet``) writes only the lines that stay.
- `live` (`bool`) (default: `None`) — Write the step again in place; by default, when `stream` is a terminal.
- `clock` (`callable`) (default: `time.monotonic`) — Gives the time in seconds, to say how long a step lasts.
- `columns` (`callable`) (default: `None`) — Gives the width of the terminal: a longer line would wrap, and only its last row would be erased. The terminal's by default.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/progress.py#L21-130)

### madbot_cli.progress.Progress.clock

*attribute* · *instance attribute*

```python
clock = clock
```

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/progress.py#L56-56)

### madbot_cli.progress.Progress.columns

*attribute* · *instance attribute*

```python
columns = columns or lambda : shutil.get_terminal_size().columns
```

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/progress.py#L57-57)

### madbot_cli.progress.Progress.live

*attribute* · *instance attribute*

```python
live = live
```

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/progress.py#L55-55)

### madbot_cli.progress.Progress.said

*attribute* · *instance attribute*

```python
said = ''
```

The last step written, out of a terminal: a wait writes it once.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/progress.py#L60-60)

### madbot_cli.progress.Progress.shown

*attribute* · *instance attribute*

```python
shown = ''
```

The step written in place, to erase before another line.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/progress.py#L58-58)

### madbot_cli.progress.Progress.started

*attribute* · *instance attribute*

```python
started = clock()
```

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/progress.py#L62-62)

### madbot_cli.progress.Progress.steps

*attribute* · *instance attribute*

```python
steps = steps
```

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/progress.py#L52-52)

### madbot_cli.progress.Progress.stream

*attribute* · *instance attribute*

```python
stream = stream
```

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/progress.py#L51-51)

### madbot_cli.progress.Progress.clear

*method*

```python
def clear() -> None
```

Erase the step written in place, once the command is over.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/progress.py#L125-130)

### madbot_cli.progress.Progress.line

*method*

```python
def line(text: str) -> None
```

Write a line that stays, such as a change, above the step under way.

**Parameters**

- `text` (`str`) — The line.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/progress.py#L108-123)

### madbot_cli.progress.Progress.step

*method*

```python
def step(text: str) -> None
```

Say a new step has started.

**Parameters**

- `text` (`str`) — What it does, such as ``reading what madbot holds``.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/progress.py#L64-75)

### madbot_cli.progress.Progress.update

*method*

```python
def update(text: str, elapsed: float | None = None) -> None
```

Say where the step under way stands, with the time it has taken.

Out of a terminal, the line is written only when `text` changes.

**Parameters**

- `text` (`str`) — Where it stands, such as ``madbot reads the data: 2/4``.
- `elapsed` (`float`) (default: `None`) — The seconds it has taken; since the last `step` by default.

[View source](https://gitlab.com/ifb-elixirfr/madbot/madbot/-/blob/c7108faae5e7dd06591be53c8d5bd5e75d880ebe/cli/madbot_cli/progress.py#L77-106)
