# importsearch CLI Cheatsheet

Quick commands you can copy & paste while testing the CLI.

## Basic run

```bash
importsearch examples/sample_dir/target.py --root examples/sample_dir --output-format print
```

When `--root` is supplied it only influences how import statements are resolved.  
The entry file itself can be relative to the current working directory, relative to the root you passed, or an absolute path.

## Text report to file

```bash
importsearch examples/sample_dir/target.py \
  --root examples/sample_dir \
  --output-format text \
  --output-file sample-report
```

The report is printed to stdout and written to `sample-report.txt`.

## JSON output

```bash
importsearch examples/sample_dir/target.py \
  --root examples/sample_dir \
  --output-format json \
  --output-file sample-report
```

Produces a JSON summary at `sample-report.json`.

## Verbose traversal

```bash
importsearch examples/sample_dir/target.py \
  --root examples/sample_dir \
  --output-format print \
  --verbose
```

Verbose mode logs missing files, summary write locations, and visited nodes.

## Custom output path

```bash
importsearch examples/sample_dir/target.py \
  --root examples/sample_dir \
  --output-format text \
  --output-file /tmp/importsearch-output
```

Writes `/tmp/importsearch-output.txt` regardless of the current working directory.
