|
10 | 10 | The Plone CLI is meant for developing Plone packages. It uses [copier](https://copier.readthedocs.io/) templates to scaffold Plone backend addons, Zope project setups, and add features like content types, behaviors, and REST API services. |
11 | 11 |
|
12 | 12 |
|
13 | | -## Demo |
14 | 13 |
|
15 | | -Scaffolding a backend add-on, adding a content type and behavior, and wiring up a REST API service: |
16 | | - |
17 | | -<video src="https://github.com/plone/plonecli/raw/master/docs/demo-backend.webm" controls muted width="100%"></video> |
18 | | - |
19 | | -> ▶ If the video does not play inline, [watch `docs/demo-backend.webm`](https://github.com/plone/plonecli/raw/master/docs/demo-backend.webm). |
20 | 14 |
|
21 | 15 | ## Compatibility |
22 | 16 |
|
@@ -132,21 +126,49 @@ This creates `~/.plonecli/config.toml` with your settings. |
132 | 126 | plonecli --help |
133 | 127 |
|
134 | 128 | Commands: |
135 | | - add Add features to your existing Plone package |
136 | | - config Configure plonecli global settings |
137 | | - create Create a new Plone package |
138 | | - debug Start the Plone instance in debug mode |
139 | | - serve Start the Plone instance |
140 | | - setup Run zope-setup inside an existing backend_addon |
141 | | - test Run the tests in your package |
142 | | - update Update copier-templates and check for plonecli updates |
| 129 | + add Add features to your existing Plone package |
| 130 | + completion Show or install shell completion |
| 131 | + config Configure plonecli global settings |
| 132 | + create Create a new Plone package |
| 133 | + debug Start the Plone instance in debug mode |
| 134 | + serve Start the Plone instance |
| 135 | + setup Run zope-setup inside an existing backend_addon |
| 136 | + skill Install/update the bundled Agent Skills for AI coding agents |
| 137 | + test Run the tests in your package |
| 138 | + update Update copier-templates and check for plonecli updates |
143 | 139 |
|
144 | 140 | Options: |
145 | 141 | -l, --list-templates List available templates |
146 | | - -V, --versions Show version information |
| 142 | + -V, --versions Show plonecli and copier-templates versions |
147 | 143 | -h, --help Show this message and exit. |
148 | 144 | ``` |
149 | 145 |
|
| 146 | +The list is context-aware: outside a Plone project only the global commands |
| 147 | +(`completion`, `config`, `create`, `skill`, `update`) are shown; inside one, |
| 148 | +`create` is replaced by the project commands. |
| 149 | + |
| 150 | +`create`, `add` and `setup` share the non-interactive options, so a package can |
| 151 | +be bootstrapped from a script or CI: |
| 152 | + |
| 153 | +```shell |
| 154 | +plonecli create addon collective.todo --defaults -d description="Todo lists" |
| 155 | +plonecli add content_type --defaults --data-file answers.yml |
| 156 | +plonecli setup --defaults -d plone_version=6.1.1 |
| 157 | +``` |
| 158 | + |
| 159 | +| Option | What it does | |
| 160 | +|---------------------|--------------------------------------------------------------------| |
| 161 | +| `-d KEY=VALUE` | Pre-fill a template answer (repeatable), skipping its prompt | |
| 162 | +| `--data-file FILE` | Load answers from a YAML/JSON file (`-d` wins on conflicts) | |
| 163 | +| `--defaults` | Use template defaults for unanswered questions instead of prompting | |
| 164 | +| `--allow-dirty` | Run even if the git repository has uncommitted changes | |
| 165 | +| `--no-git` | Skip the auto-commit (`create`, `add`) | |
| 166 | + |
| 167 | +On a repository with uncommitted changes, an interactive run asks whether to |
| 168 | +continue, and a non-interactive one (`--defaults`, or no terminal) aborts so |
| 169 | +generated files never silently mix into your work in progress. Pass |
| 170 | +`--allow-dirty` when that mixing is intended. |
| 171 | + |
150 | 172 |
|
151 | 173 | ### Creating a Plone Add-on |
152 | 174 |
|
@@ -205,6 +227,20 @@ With verbose output: |
205 | 227 | plonecli test --verbose |
206 | 228 | ``` |
207 | 229 |
|
| 230 | +Run a single test, or restrict the run to one package: |
| 231 | + |
| 232 | +```shell |
| 233 | +plonecli test -t test_behavior_installed |
| 234 | +plonecli test -s src/collective/todo |
| 235 | +``` |
| 236 | + |
| 237 | +Both are passed to the project's `invoke test` task: `-t/--test` becomes pytest's |
| 238 | +`-k`, and `-s/--package` becomes the pytest target path. `plonecli test` exits |
| 239 | +with the test run's exit code, so it can gate a script or a CI job. |
| 240 | + |
| 241 | +Projects generated before the task gained these parameters need their `tasks.py` |
| 242 | +refreshed with `plonecli update && plonecli setup`. |
| 243 | + |
208 | 244 |
|
209 | 245 | ### Debug Mode |
210 | 246 |
|
@@ -314,6 +350,10 @@ local_path = "~/.copier-templates/plone-copier-templates" |
314 | 350 |
|
315 | 351 | The default Plone version is fetched from `https://dist.plone.org/release/` and cached for 24 hours. |
316 | 352 |
|
| 353 | +Run `plonecli config` to (re)write the file interactively. If it ever becomes |
| 354 | +unreadable, plonecli says so and names the path — delete it and run |
| 355 | +`plonecli config` again to start fresh. |
| 356 | + |
317 | 357 | ### Environment Variables |
318 | 358 |
|
319 | 359 | You can override template configuration using environment variables. These take precedence over the config file: |
|
0 commit comments