Skip to content

[Bug] opencli browser --window only works before the leaf subcommand #1850

@alanxchen85

Description

@alanxchen85

Summary

opencli browser supports --window, but the option only works when attached to the parent browser command:

opencli browser beehiiv --window background open https://example.com

The more obvious leaf-command placement fails:

opencli browser beehiiv open https://example.com --window background
# error: unknown option '--window'

Repro

Version:

opencli --version
# 1.8.2

Working:

opencli browser beehiiv --window foreground open https://example.com
opencli browser beehiiv --window background open https://example.com
OPENCLI_WINDOW=background opencli browser beehiiv open https://example.com

Failing:

opencli browser beehiiv open https://example.com --window foreground
# error: unknown option '--window'

Also confusing:

opencli browser --help

shows --window <mode>, but:

opencli browser beehiiv open --help

does not show --window, so it looks unsupported on the leaf command.

What seems to be happening

--window is implemented, but it is registered on the parent browser command rather than the leaf subcommands. So placement matters in a way that is not obvious from the UX.

Expected

One of:

  1. Accept --window in the common leaf position too, e.g. ... open <url> --window background, or
  2. Keep the current parser behavior, but make the help/docs much more explicit that the correct form is:
opencli browser <session> --window <foreground|background> <subcommand> ...

I hit this while trying to keep automation in a background window. The feature works; the command shape is just easy to misuse.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions