# What Are the nocolor and noclear CLI Flags in Holehe?

> Discover how nocolor and noclear CLI flags in Holehe improve compatibility with legacy terminals CI pipelines and logging systems by disabling colored output and screen clearing.

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

---

**The `nocolor` and `noclear` flags in Holehe disable ANSI colored output and terminal screen clearing respectively, ensuring compatibility with legacy terminals, CI pipelines, and logging systems.**

Holehe is an open-source OSINT tool maintained by megadose that verifies email address registration across multiple online services. The command-line interface defined in [[`holehe/core.py`](https://github.com/megadose/holehe/blob/main/holehe/core.py)](https://github.com/megadose/holehe/blob/master/holehe/core.py) includes the `nocolor` and `noclear` CLI flags to control terminal formatting behavior for environments that cannot process ANSI escape sequences.

## CLI Flag Definitions in holehe/core.py

The argument parser in [`holehe/core.py`](https://github.com/megadose/holehe/blob/main/holehe/core.py) registers both switches as optional boolean flags using `dest` parameters to store the inverse logic:

- **`--no-color`** maps to `dest="nocolor"` with the help text "Don't color terminal output"
- **`--no-clear`** maps to `dest="noclear"` with the help text "Do not clear the terminal to display the results"

When invoked, these arguments populate the `args` namespace object that subsequent UI functions consult before rendering output.

## How nocolor Disables Terminal Colors

Inside the `print_result` function, a helper called `print_color` checks the `args.nocolor` boolean to determine formatting:

- **Default behavior (nocolor=False):** The helper wraps text with `termcolor.colored` to inject ANSI color codes for success, failure, and rate-limit indicators.
- **With `--no-color` (nocolor=True):** The helper returns the raw text string without wrappers, outputting plain text suitable for Windows CMD without ANSI support, CI log collectors, or file redirects.

This separation keeps color logic isolated from the core asynchronous scanning workflow (`launch_module`, `asyncio` tasks), ensuring that disabling color has zero impact on search performance.

## How noclear Preserves Terminal History

Before displaying results, Holehe evaluates `args.noclear` to decide whether to reset the terminal viewport:

- **Default behavior (noclear=False):** The script issues the ANSI escape sequence `"\033[H\033[J]"` to clear the screen and position the cursor at the top-left, creating a clean results dashboard.
- **With `--no-clear` (noclear=True):** The script omits the escape sequence and prints a single newline instead, preserving previous terminal contents.

This behavior is critical when piping output to tools like `tee`, `grep`, or Docker log collectors that capture stdout line-by-line, as the clear-screen command can interfere with stream processing or create gaps in persistent logs.

## When to Use These Flags

Use these switches in the following scenarios:

- **CI/CD pipelines:** Enable `--no-color` to prevent unreadable raw ANSI codes in Jenkins, GitHub Actions, or GitLab job logs.
- **Windows compatibility:** Legacy Command Prompt sessions without ANSI support require `--no-color` for readable text.
- **Log archiving:** Combine `--no-clear` with `--no-color` when redirecting output to a file to ensure the log contains only the results without terminal control characters.
- **Debugging:** Use `--no-clear` to keep error messages or previous command history visible on screen while iterating on searches.

## Practical Usage Examples

Run Holehe with different combinations of these flags to control the output format:

```bash

# Default behavior: colored output with screen cleared before results

holehe user@example.com

# Plain-text output for log files or terminals without ANSI support

holehe user@example.com --no-color

# Preserve existing terminal content (useful when piping to another tool)

holehe user@example.com --no-clear

# Combine both options for maximum compatibility

holehe user@example.com --no-color --no-clear

```

## Summary

- **[`holehe/core.py`](https://github.com/megadose/holehe/blob/main/holehe/core.py)** defines `--no-color` (`dest="nocolor"`) and `--no-clear` (`dest="noclear"`) via Python's `ArgumentParser`.
- **`nocolor`** disables `termcolor.colored` wrapping in `print_result`, forcing plain text output.
- **`noclear`** suppresses the `"\033[H\033[J"` ANSI clear-screen escape sequence, printing a newline instead.
- Both flags are **performance-neutral**; they only affect string handling in the UI layer and do not alter the asynchronous scanning engine.
- Use these flags for CI/CD compatibility, Windows CMD support, or when piping Holehe output to downstream processors.

## Frequently Asked Questions

### What is the purpose of the nocolor flag in Holehe?

The `nocolor` flag disables ANSI color codes in terminal output. When you pass `--no-color`, the `print_color` helper in [`holehe/core.py`](https://github.com/megadose/holehe/blob/main/holehe/core.py) returns raw text instead of wrapping results with `termcolor.colored`, ensuring readable output in environments that do not support ANSI formatting.

### What is the purpose of the noclear flag in Holehe?

The `noclear` flag prevents the terminal screen from being cleared before displaying results. By default, Holehe sends the escape sequence `"\033[H\033[J"` to reset the viewport, but with `--no-clear`, the script simply prints a newline, preserving previous terminal history for logging or debugging purposes.

### How do I use both flags together?

You can combine both flags in a single command to produce plain text output without clearing the screen: `holehe user@example.com --no-color --no-clear`. This combination is ideal for redirecting output to files or piping to other command-line tools that expect unformatted text streams.

### Do these flags affect the scanning performance?

No. The `nocolor` and `noclear` flags only influence the `print_result` UI formatting functions. They do not modify the `launch_module` async workflow or the `asyncio` task execution, so enabling or disabling them has negligible impact on the total runtime of the email verification process.