Files
MeshTerm/meshterm/host/__main__.py
T
Jean-Pierre MartineauandClaude Opus 5.5 b6e7cd5c16 The handhelds are named for their variant: picocalc-lyra and cardputer-zero
M5Stack makes three Cardputers and only the Zero runs Linux; the PicoCalc
takes several cores and only the Luckfox Lyra runs MeshTerm. So the bare
names were ambiguous, and every reference to the two devices now carries
the variant: the --platform values and MESHTERM_PLATFORM, the Platform
constants (PICOCALC_LYRA, CARDPUTER_ZERO), their lane decks and every
screen's picocalc_lyra_lane / cardputer_zero_lane, the font inventories,
the lane chips' theme styles, the scripts/ folders, the two chrome test
files, and the docs and CLAUDE.md that name them.

There is no alias: --platform picocalc is refused with the three real
choices listed, rather than falling back to the desktop layout. The
PicoCalc is auto-detected from its device tree, so it needs nothing.
What names hardware or a user's data keeps its name: the PicoCalc
keyboard's input-device name, its battery's sysfs supply, and the serial
profile the Lyra setup script writes. .gitignore follows the firmware's
folder, and the changelog keeps the words each release used.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-04 11:52:41 -04:00

55 lines
1.6 KiB
Python

# SPDX-License-Identifier: Apache-2.0
"""``python -m meshterm.host`` — run MeshTerm in the Cardputer Zero's console host.
python -m meshterm.host [--sim [--scale N] | --device] [MESHTERM ARGS...]
``--sim`` (the default off the device) opens the desktop simulator; ``--device`` draws to
the framebuffer and reads the keyboard, and is the default wherever the launcher has named
a framebuffer (``APPLAUNCH_LINUX_FBDEV_DEVICE``). Everything else is passed to MeshTerm as
it would be on a command line — ``--mock`` for the simulated mesh, ``--ble``/``--port``/
``--tcp`` for a companion — with ``--platform cardputer-zero`` supplied by the host.
"""
from __future__ import annotations
import os
import sys
def main(argv: list[str]) -> int:
"""Parse the host's own flags, pass the rest to MeshTerm, and run it."""
from .device import FB_ENV
from .run import run
device = bool(os.environ.get(FB_ENV))
scale = 3
rest: list[str] = []
args = iter(argv)
for arg in args:
if arg == "--sim":
device = False
elif arg == "--device":
device = True
elif arg == "--scale":
scale = max(1, int(next(args, "3")))
else:
rest.append(arg)
if device:
from .device import front_end
else:
from .sim import front_end as sim_front_end
def front_end():
return sim_front_end(scale)
try:
build = front_end()
except FileNotFoundError as missing:
print(f"meshterm host: {missing}", file=sys.stderr)
return 1
return run(rest, build)
if __name__ == "__main__":
sys.exit(main(sys.argv[1:]))