# How `--only-used` and `--no-clear` CLI Flags Affect Holehe's Output

> Discover how --only-used and --no-clear flags alter megadose/holehe output. Filter results to only used sites and prevent terminal clears for precise data.

- Repository: [Palenath/holehe](https://github.com/megadose/holehe)
- Tags: how-to-guide
- Published: 2026-08-15

---

**The `--only-used` flag filters Holehe's output to show only sites where the email address is registered, while `--no-clear` prevents the terminal from being cleared before displaying results.**

Holehe is an open-source tool by **megadose** that checks whether an email address is registered across multiple websites. Its command-line interface uses **argparse** in [`holehe/core.py`](https://github.com/megadose/holehe/blob/main/holehe/core.py) to control output behavior. These two flags directly impact what you see and how your terminal is prepared before results appear.

## `--only-used` Filter: Show Only Confirmed Accounts

The `--only-used` flag is defined at **line 84** of [`holehe/core.py`](https://github.com/megadose/holehe/blob/main/holehe/core.py). By default, this option is **false**, meaning Holehe prints every site it checks with status indicators:

- `[+]` — email exists (used)
- `[-]` — email does not exist (unused)
- `[x]` — rate limited
- `[!]` — error

When you pass `--only-used`, the printing loop at **lines 122–136** skips all non-positive results. It only displays entries where `results["exists"] == True`. This dramatically reduces noise when you only care about confirmed account registrations.

```bash

# Default: show all sites with their status

holehe user@example.com

# Filtered: show only sites where the email is registered

holehe user@example.com --only-used

```

## `--no-clear` Flag: Preserve Terminal History

The `--no-clear` flag is defined at **line 88** of [`holehe/core.py`](https://github.com/megadose/holehe/blob/main/holehe/core.py) with `dest="noclear"`. Before printing results, the `print_result` function checks this argument:

- **Default (false)**: Clears the terminal using the ANSI sequence `"\033[H\033[J"` at **line 114**
- **When true (`--no-clear`)**: Prints a blank line instead at **line 115**, keeping previous terminal output visible

This flag is essential when piping output to log files or when you need to maintain context from earlier commands.

```bash

# Default: clear screen before showing results

holehe user@example.com

# Preserve terminal history

holehe user@example.com --no-clear

# Pipe to file without losing previous terminal output

holehe user@example.com --no-clear > results.txt

```

## Combining Both Flags

You can stack both options to get filtered results without clearing your terminal:

```bash
holehe user@example.com --no-clear --only-used

```

This combination is particularly useful for **automated scripts** where you want clean, actionable output appended to existing logs.

## Source Code Implementation Details

Both flags are implemented in the same file with clear separation of concerns:

| Location | Purpose |
|----------|---------|
| [`holehe/core.py`](https://github.com/megadose/holehe/blob/main/holehe/core.py) lines 84–90 | CLI argument definitions using `argparse` |
| [`holehe/core.py`](https://github.com/megadose/holehe/blob/main/holehe/core.py) line 114 | ANSI clear sequence execution |
| [`holehe/core.py`](https://github.com/megadose/holehe/blob/main/holehe/core.py) line 115 | Blank line alternative for `--no-clear` |
| [`holehe/core.py`](https://github.com/megadose/holehe/blob/main/holehe/core.py) lines 122–136 | Output filtering logic for `--only-used` |

The [`holehe/__init__.py`](https://github.com/megadose/holehe/blob/main/holehe/__init__.py) file serves as the package entry point by calling `main()`, which triggers the argument parsing sequence that consumes these flags.

## Summary

- **`--only-used`** — Filters output to display only sites where `results["exists"] == True`, hiding unused, rate-limited, and error results
- **`--no-clear`** — Prevents the ANSI terminal clear sequence, preserving previous command output by printing a blank line instead
- Both flags are defined in [`holehe/core.py`](https://github.com/megadose/holehe/blob/main/holehe/core.py) using standard **argparse** patterns
- Flags can be combined for scripted workflows and log preservation

## Frequently Asked Questions

### Where are the `--only-used` and `--no-clear` flags defined in Holehe?

Both flags are defined in [`holehe/core.py`](https://github.com/megadose/holehe/blob/main/holehe/core.py) using `argparse`. The `--only-used` flag appears at **line 84** with `dest="onlyused"`, and `--no-clear` appears at **line 88** with `dest="noclear"`. These definitions control how the arguments are parsed and passed to the output functions.

### What does the `--only-used` flag actually filter out?

The `--only-used` flag filters based on the `exists` key in each result dictionary. When enabled, Holehe skips printing any site where the email is unused (`[-]`), rate-limited (`[x]`), or errored (`[!]`). Only positive matches (`[+]`) appear in the terminal output.

### Why would I use `--no-clear` instead of the default behavior?

Use `--no-clear` when you need to preserve terminal history for context, when piping output to files or other commands, or when running Holehe in automated scripts where erasing previous output would disrupt logging. The flag replaces the ANSI clear sequence with a simple blank line.

### Can I use both flags together with other Holehe options?

Yes. Both flags are independent boolean options that can be combined with any standard Holehe invocation. They also work correctly when output is redirected to files or piped to other tools.