Usage#

ocom manages network/privacy tools (OpenVPN, SpoofDPI/GoodbyeDPI, Cloudflare WARP, Tailscale) through a Textual terminal user interface, with a small command-line interface built into the same ocom command.

Launching the TUI#

Run the interactive subcommand to start the terminal user interface:

ocom interactive

Inside the app, each tool card shows the tool’s status and an action button to install, start, or stop it. Starting a tool automatically stops any running tool it conflicts with.

The tools the dashboard shows can also be listed from Python, without starting the TUI:

examples/tool_registry.py#
"""List the tools the TUI dashboard manages, without starting it."""

from __future__ import annotations

from ocom.core.tools import get_all_tools


def tool_names() -> list[str]:
    """Return the names of the tools available on this platform.

    Returns:
        list[str]: One name per tool card the dashboard shows.
    """
    return [tool.name for tool in get_all_tools()]

Command-line interface#

Running ocom with no arguments (or ocom --help) lists the subcommands:

ocom version   # print the installed version
ocom info      # print version, Python, and platform details

Or invoke it programmatically from Python:

examples/cli_usage.py#
"""CLI argument parsing."""

from __future__ import annotations

from ocom.cli.app import app


def cli_app_name() -> str:
    """Return the registered CLI application name.

    Returns:
        str: The Typer application name.
    """
    return app.info.name or ""

Look up the installed distribution version:

examples/version_lookup.py#
"""Look up the version of the installed distribution."""

from importlib.metadata import version

from ocom.__metadata__ import PROJECT_NAME


def version_lookup() -> str:
    """Return the installed distribution version for this project.

    Returns:
        str: The installed distribution version.
    """
    return version(PROJECT_NAME)

For short interactive snippets embedded in prose, the docs-doctest task executes >>> blocks too:

>>> from ocom.__metadata__ import PROJECT_NAME
>>> PROJECT_NAME
'ocom'