Skip to content

Add non-interactive --defaults/--data/--data-file to create and add#100

Merged
MrTango merged 3 commits into
masterfrom
MrTango/non-interactive-data
May 21, 2026
Merged

Add non-interactive --defaults/--data/--data-file to create and add#100
MrTango merged 3 commits into
masterfrom
MrTango/non-interactive-data

Conversation

@MrTango
Copy link
Copy Markdown
Contributor

@MrTango MrTango commented May 21, 2026

Summary

  • Add --defaults, -d/--data KEY=VALUE (repeatable), and --data-file PATH (YAML/JSON) options to plonecli create and plonecli add, so copier can be driven without interactive prompts (Claude Code / CI). Inline -d overrides matching keys from --data-file.
  • Plumb a defaults flag through run_create/run_add into copier's defaults= so unanswered questions fall back to template defaults instead of prompting.
  • Generalize the InterspersedCommand workaround so flags can follow positional args on the chained CLI group, and apply it to create/add.
  • Update the bundled plonecli skill (SKILL.md, reference/add.md, reference/create.md) to instruct non-interactive usage and never hand-write files copier would generate.

Test plan

  • uv run pytest tests/test_plonecli.py — covers non-interactive add/create, data-file merge precedence, missing data-file, and malformed KEY=VALUE.
  • uv run pytest tests/test_all_templates_data.py — asserts every template question is answerable via data; opt-in integration marker generates each template non-interactively.

MrTango added 3 commits May 21, 2026 14:51
create and add dropped into copier's interactive prompts, which cannot
be answered in non-tty environments (Claude Code, CI). Expose the
existing data passthrough on the CLI:

- --defaults: use template defaults for unasked questions (no prompts)
- -d/--data KEY=VALUE: pre-fill a single answer (repeatable)
- --data-file PATH: load answers from a YAML/JSON file (-d overrides)

Update the bundled skill to drive plonecli non-interactively instead of
hand-rolling subtemplate output. Add tests covering the new flags and a
test verifying every template's settings are answerable via data.

Co-Authored-By: MrTango <md@derico.de>
_all_templates() is evaluated at collection time inside @parametrize, so
it must not call pytest.skip. Yield nothing when no templates dir exists,
leaving an empty parameter set; keep pytest.skip in _templates_dir() for
runtime use inside tests.
@MrTango MrTango merged commit a930209 into master May 21, 2026
6 checks passed
@MrTango MrTango deleted the MrTango/non-interactive-data branch May 21, 2026 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant