cwp open
shipped 1.0.0cwp open [env] [flags]
Acts on the local site unless an environment is named.
| Argument | What it is | Default |
|---|---|---|
[env] | environment to open (default: the local DDEV site) |
| Flag | What it does | Default |
|---|---|---|
--print | write the URL to stdout and open nothing | off |
Plus the shared flags --json, --verbose and --dry-run.
What it does
Opens the site in a browser.
The URL comes from DDEV itself locally — falling back to the conventional
<name>.ddev.site when the project is stopped — and from environments.<env>.url
remotely, for any provider, so an ssh environment answers with its own URL.
open is used on macOS and xdg-open elsewhere.
A missing opener is not a failure. On a headless machine, over SSH, or on
Windows — where cwp deliberately ships no opener rather than an untested
cmd /c start — it prints the URL and exits 0.
--print writes the URL to stdout and opens nothing. That is the scriptable
form, and the one place in this command where stdout carries a payload; it cannot
be combined with --json, since both claim stdout, and cwp refuses rather than
corrupting one of them.
Example
cwp open # the local DDEV URL
cwp open prod # the environment's configured url
open "$(cwp open prod --print)" # on a machine cwp has no opener for
What it does not do
It starts nothing. If DDEV is stopped, cwp open shows you the URL the project
will have — ddev start is yours to run.