Summary
jtc config set accepts plugin-specific options like --tests, --git, --formatter, etc., each documented as taking KEY=VALUE pairs. There are three problems with how multiple pairs are accepted today:
- Comma-separated form silently mis-parses.
--tests "aqua=true,project=true" does not error and does not get split; instead it produces a corrupt list value.
- Repeating the flag does not append.
--tests aqua=true --tests project=true only keeps the last value — the earlier one is lost. The Python port (JuliaPkgTemplatesCLI) supported the repeat form, so this is a regression for users porting their muscle memory.
- The intended form (space-separated single string) is not documented anywhere user-visible. It only appears in an internal source comment.
The result is that the same intent (set two plugin keys at once) can produce three different and silently wrong configurations depending on which form a user types.
Reproduction
Using --config-file to avoid touching the global config:
# (1) Comma-separated form — accepted, but corrupt
$ julia --project=. -e 'using PkgTemplatesCommandLineInterface; PkgTemplatesCommandLineInterface.main(ARGS)' -- \
config set --tests "aqua=true,project=true" --config-file /tmp/jtc-test.toml
[ Info: Configuration saved to /tmp/jtc-test.toml
Set default Tests.aqua: ["true", "project=true"]
Resulting TOML:
[default.Tests]
aqua = ["true", "project=true"]
Tests.aqua is a boolean option, but a list value was persisted.
# (2) Repeated flag — last value wins, earlier value is silently dropped
$ ... config set --tests aqua=true --tests project=true --config-file /tmp/jtc-test.toml
Set default Tests.project: true
Resulting TOML:
[default.Tests]
project = true
aqua=true is missing.
# (3) Space-separated single string — works correctly
$ ... config set --tests "aqua=true project=true" --config-file /tmp/jtc-test.toml
Set default Tests.project: true
Set default Tests.aqua: true
Resulting TOML:
[default.Tests]
aqua = true
project = true
Why users would type the broken forms
-
The help text for --tests (and every other plugin flag) only says Set <Plugin> plugin defaults (omit value to enable with defaults) with metavar KEY=VALUE. There is no example of how to provide multiple pairs.
-
The help text for --author does document two forms explicitly: Examples: --author 'A, B' or --author 'A' --author 'B'. Supports both single and multiple authors. Users naturally generalise this to plugin flags and try --tests "aqua=true,project=true" — which then mis-parses.
-
Users coming from the Python port (JuliaPkgTemplatesCLI) will try repeating --tests because that is the form that worked there.
-
The actual intended form — space-separated KEY=VALUEs in a single shell-quoted string — only appears in src/cli.jl:186 as an internal comment:
# `argumentless_as_flag=true` matches the legacy `create` registration where
# zero-arg plugins become bare flags. When false, every plugin accepts an
# optional space-separated KEY=VALUE string (`--plugin` / `--plugin "k=v ..."`).
Suggested fixes
Pick any combination:
- Reject malformed values for known-scalar keys.
Tests.aqua is a boolean — a list value should error out instead of being persisted.
- Document the supported form in the help text of every plugin flag, e.g.
Multiple keys: --tests "aqua=true project=true".
- Also accept repeat and comma-separated forms, and normalise all three to the same internal representation. This matches what
--author already trains users to expect, and avoids regressing users coming from the Python port.
- Echo a unified diff before saving and require confirmation when a previously-set scalar would be replaced by a list (or vice-versa). This would also catch (1) at runtime.
- Update the README to show at least one explicit example of setting multiple keys for a single plugin, in whatever form ends up being canonical.
Environment
- Source:
PkgTemplatesCommandLineInterface.jl (this repository), invoked via julia --project=. -e 'using PkgTemplatesCommandLineInterface; PkgTemplatesCommandLineInterface.main(ARGS)' -- ...
- Verified against
--config-file /tmp/jtc-test.toml to avoid touching the global config.
Summary
jtc config setaccepts plugin-specific options like--tests,--git,--formatter, etc., each documented as takingKEY=VALUEpairs. There are three problems with how multiple pairs are accepted today:--tests "aqua=true,project=true"does not error and does not get split; instead it produces a corrupt list value.--tests aqua=true --tests project=trueonly keeps the last value — the earlier one is lost. The Python port (JuliaPkgTemplatesCLI) supported the repeat form, so this is a regression for users porting their muscle memory.The result is that the same intent (set two plugin keys at once) can produce three different and silently wrong configurations depending on which form a user types.
Reproduction
Using
--config-fileto avoid touching the global config:Resulting TOML:
Tests.aquais a boolean option, but a list value was persisted.Resulting TOML:
aqua=trueis missing.Resulting TOML:
Why users would type the broken forms
The help text for
--tests(and every other plugin flag) only saysSet <Plugin> plugin defaults (omit value to enable with defaults)with metavarKEY=VALUE. There is no example of how to provide multiple pairs.The help text for
--authordoes document two forms explicitly:Examples: --author 'A, B' or --author 'A' --author 'B'. Supports both single and multiple authors.Users naturally generalise this to plugin flags and try--tests "aqua=true,project=true"— which then mis-parses.Users coming from the Python port (JuliaPkgTemplatesCLI) will try repeating
--testsbecause that is the form that worked there.The actual intended form — space-separated KEY=VALUEs in a single shell-quoted string — only appears in
src/cli.jl:186as an internal comment:Suggested fixes
Pick any combination:
Tests.aquais a boolean — a list value should error out instead of being persisted.Multiple keys: --tests "aqua=true project=true".--authoralready trains users to expect, and avoids regressing users coming from the Python port.Environment
PkgTemplatesCommandLineInterface.jl(this repository), invoked viajulia --project=. -e 'using PkgTemplatesCommandLineInterface; PkgTemplatesCommandLineInterface.main(ARGS)' -- ...--config-file /tmp/jtc-test.tomlto avoid touching the global config.