A basic command line shell script for outputting informations about ProcessWire pages.
- Follow the instructions from Include & Bootstrap on the ProcessWire website.
- Edit
#!/usr/bin/phpto match your local dev setting. - Edit the path in
include("/path/to/processwire/index.php");to match your ProcessWire location.
The basic usage pattern looks like this: pw <apiMethod> "selector" [field]*
pw: maps to the name of the main file in this repository (required).<apiMethod>: a ProcessWire API method likegetorfind(required)."selector": a ProcessWire selector like"template=basic-page,children.count>5,limit=3"(required).[field]*: custom fields you want to output (optional).
pw get "/"– Gets the root page and outputs the standard output defined inpw.pw find "template=basic-page,limit=5" id name parent children– Gets 5 pages with the templatebasic-pageand only outputs the fieldsid,name,parentandchildrenfor each found page.pw help– Outputs usage instructions regarding the shell script.
- For performance reasons pages output is limitted to 100. Adjust to fit your needs.
- When you don’t specify custom fields after the selector (aka the
[field]*part) then a standard set of fields will be output.