#!/usr/bin/env python3
"""Fi-Wi test framework CLI — maps and SSH env files resolve to this file’s directory."""

import os
import sys

import fiwi.paths as _paths

_paths.configure(os.path.dirname(os.path.abspath(__file__)))


def _prefer_line_buffered_stdio() -> None:
    """Flush stdout/stderr after each newline when attached to a pipe (e.g. SSH capture)."""
    for stream in (sys.stdout, sys.stderr):
        reconf = getattr(stream, "reconfigure", None)
        if reconf is None:
            continue
        try:
            reconf(line_buffering=True)
        except (OSError, ValueError, AttributeError):
            pass


_prefer_line_buffered_stdio()

from fiwi.cli import main

if __name__ == "__main__":
    raise SystemExit(main())
