Skip to content

cwp content pull

shipped 1.0.0
cwp content pull [env] [flags]

Acts on the local site unless an environment is named.

ArgumentWhat it isDefault
[env]environment to read (omit for the local site)
FlagWhat it doesDefault
--post <selector...>slug, post id or URL — repeatable
--type <post_type>restrict to one post type
--allevery post in scopeoff
--forceoverride the protected-environment refusaloff
--no-backupskip the remote backup taken before the writeon
--yesskip the confirmation promptoff

Plus the shared flags --json, --verbose and --dry-run.

What it does

Brings named posts from a site into the committed tree.

A bare cwp content pull is refused, not read as --all. It is one word from cwp pull, which replaces your whole local database, and a command that guessed here would be guessing about the wrong one.

Selection is explicit: --post <slug|id|url> repeatable, --type <post_type>, or --all.

A pull writes to the site it reads

Two things go up, and against a remote that means the full guard set — the confirmation, the restore point, --force on a protected environment:

  • the uid of anything adopted, so the item keeps its identity across a rename;
  • _cwp_sync, the hash of what cwp just took, which is what the next push compares against.

A local pull writes to no remote and asks nothing. This is the one place in cwp where a command named pull has an upward effect, and it is declared as one rather than excused.

Example

cwp content pull --post about-us      # from the local site into content/
cwp content pull dev --type page
cwp content pull dev --all

What it does not do

It does not delete files in the tree that the site no longer has. A pull that changes nothing writes nothing, so re-running one does not dirty the tree or move an mtime.

It does not download media. The committed file describes each attachment by path; the files themselves travel with cwp pull or the uploads proxy.