From 0da56bed45ec10634644bf7195466920190c1048 Mon Sep 17 00:00:00 2001 From: Prad Nukala Date: Wed, 7 Oct 2026 12:45:20 -0400 Subject: [PATCH] feat(cli): add --new flag to start new omp session --- dot_local/bin/executable_omp-session | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/dot_local/bin/executable_omp-session b/dot_local/bin/executable_omp-session index 93058d4..a783ccd 100755 --- a/dot_local/bin/executable_omp-session +++ b/dot_local/bin/executable_omp-session @@ -20,11 +20,13 @@ Cable entry points: omp-session --list one "displaysession file" record per session omp-session --preview FILE title, cwd, and the conversation's message text omp-session --resume FILE the cable's enter action: `omp --resume FILE` + omp-session --new the cable's ctrl-n action: a new `omp` session Env: - OMP_SESSION_STATE=FILE --resume writes `ran` to it, so the launcher can tell - a resumed session from a cancelled picker and only - move the cursor back up after a cancel (tv --inline). + OMP_SESSION_STATE=FILE --resume/--new write `ran` to it, so the launcher can + tell a started session from a cancelled picker and + only move the cursor back up after a cancel (tv + --inline). PI_CODING_AGENT_DIR omp's agent dir (default ~/.omp/agent). """ @@ -219,10 +221,14 @@ def cmd_preview(path): print(f"\n{colors[role]}▌ {role}\033[0m\n{text}") -def cmd_resume(path): +def mark_ran(): state = os.environ.get("OMP_SESSION_STATE") if state: Path(state).write_text("ran\n") + + +def cmd_resume(path): + mark_ran() os.execvp("omp", ["omp", "--resume", str(path)]) @@ -230,6 +236,7 @@ def cmd_resume(path): def new_session(): + mark_ran() os.execvp("omp", ["omp"]) @@ -279,8 +286,10 @@ def main(argv): cmd_preview(argv[1]) elif argv[0] == "--resume" and len(argv) == 2: cmd_resume(argv[1]) + elif argv == ["--new"]: + new_session() else: - sys.exit("usage: omp-session [--list | --preview FILE | --resume FILE]") + sys.exit("usage: omp-session [--list | --preview FILE | --resume FILE | --new]") if __name__ == "__main__":