Skip to content

Open a specific chat via --chat CLI flag #316

Description

@fuleinist

Problem

The TUI loads every saved chat as a horizontal tab; users with many chats have to cycle through Ctrl+Tab to find a specific one, and there is no way to launch oterm directly into a particular chat from the shell.

Solution

Add an --chat <id_or_name> CLI flag (and a complementary --new flag for the inverse). When --chat is passed, look the chat up by integer id or by name — matching the most recent chat on a name collision — and set it as the active tab in on_mount. If no match is found, print a friendly error listing the available chats and exit non-zero.

This is a small, additive change: roughly 10-20 lines in src/oterm/cli/oterm.py to thread the option into the app, and a few lines in src/oterm/app/oterm.py#on_mount to set tabs.active after the existing tab-loading loop. No new dependencies.

Use case

Users can create shell aliases like alias code='oterm --chat=code-helper' or wrapper scripts that jump straight to a specific project chat, and compose with the existing --config flag for per-project context stores.

Alternatives considered

  • Fuzzy finder inside the TUI (issue a suggestion on historical chat selection #52): would also help, but solves a different problem (interactive discovery). A CLI flag is the right tool for scripted/aliased launch flows.
  • --last flag to open the most recent chat: would be a nice complement, but --chat <id_or_name> subsumes it (e.g. --chat last).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions