Skip to content

CLI: add per-subcommand --help for all commands - #128

Merged
lawrencecchen merged 1 commit into
mainfrom
issue-119-cli-help
Feb 20, 2026
Merged

lawrencecchen merged 1 commit into
mainfrom
issue-119-cli-help

Conversation

@lawrencecchen

Copy link
Copy Markdown
Contributor

Summary

  • Add --help / -h support to 22 subcommands that accept arguments/flags
  • Help is dispatched before socket connection, so it works even when cmux isn't running
  • Each help text includes usage line, flags with descriptions, and examples
  • Simple no-arg commands (ping, help, list-windows, etc.) fall through to the top-level usage

Subcommands with help

focus-window, close-window, move-workspace-to-window, move-surface, reorder-surface, reorder-workspace, new-workspace, new-split, new-pane, new-surface, close-surface, drag-surface-to-split, close-workspace, select-workspace, send, send-key, send-panel, send-key-panel, notify, claude-hook, browser, focus-pane

Before

$ cmux new-workspace --help
OK 7A3B2C1D-...   # silently created a workspace

After

$ cmux new-workspace --help
Usage: cmux new-workspace [--command <text>]

Create a new workspace.

Flags:
  --command <text>  Run a command in the new workspace after creation

Examples:
  cmux new-workspace
  cmux new-workspace --command "cd /project && claude"

Test plan

  • cmux new-workspace --help prints help instead of creating a workspace
  • cmux send --help prints help
  • cmux browser --help prints help
  • cmux --help still prints top-level usage
  • All above work even when cmux app is not running

Closes #119

Previously, --help/-h was only checked at the top level before command
dispatch. Running e.g. `cmux new-workspace --help` would execute the
command instead of printing help.

Add per-subcommand help text for all commands that take arguments/flags.
The help check runs before socket connect so it works even when cmux is
not running. Commands without dedicated help (ping, help, list-windows,
etc.) fall through to normal behavior.
@cmux-agent

cmux-agent Bot commented Feb 20, 2026 •

Copy link
Copy Markdown
Contributor

Preview Videos and Screenshots

Open Workspace (1 hr expiry) · Open Dev Browser (1 hr expiry) · Open Diff Heatmap

Screenshot status is unknown for this run.


Generated by manaflow preview system

@vercel

vercel Bot commented Feb 20, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cmux Ready Ready Preview, Comment Feb 20, 2026 6:27am

@lawrencecchen
lawrencecchen merged commit eb86606 into main Feb 20, 2026
5 checks passed
@lawrencecchen
lawrencecchen deleted the issue-119-cli-help branch February 20, 2026 06:29

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ed2956ddc7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread CLI/cmux.swift
Comment on lines +447 to +448
if commandArgs.contains("--help") || commandArgs.contains("-h") {
if dispatchSubcommandHelp(command: command, commandArgs: commandArgs) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Respect -- terminator when detecting subcommand help

This pre-dispatch check treats any --help/-h token in commandArgs as a help request, even when it appears after the argument terminator. Commands like send/send-key explicitly support [--] to pass literal values, so cmux send -- --help or cmux send-key -- -h should forward those literals, but now they print help and return early instead. That is a behavior regression for scripts/automation that need to send these exact strings.

Useful? React with 👍 / 👎.

bn-l pushed a commit to bn-l/cmux that referenced this pull request Apr 3, 2026
…manaflow-ai#128)

Previously, --help/-h was only checked at the top level before command
dispatch. Running e.g. `cmux new-workspace --help` would execute the
command instead of printing help.

Add per-subcommand help text for all commands that take arguments/flags.
The help check runs before socket connect so it works even when cmux is
not running. Commands without dedicated help (ping, help, list-windows,
etc.) fall through to normal behavior.

This branch was successfully deployed

1 active deployment
Preview — ed2956dd Deployed Feb 20, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLI: --help flag on subcommands is silently ignored or triggers the command

1 participant