-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(json-init): add a --with-json-config=path/to/config.json flag for passing json to init #279
Conversation
I think the fundamental question here is whether the input should overwrite the Cargo.toml completely, or if it should be a set of updates overlayed onto the current value. Specifically this affects fields that are omitted from the json -- is that "delete the key" or "preserve the old value"? |
On config handling rework (stuff now generally works a bit more like oranda config):
|
…r passing json to init This exists for hosted services that want to edit the toml mechanically. The format is basically the json equivalent of `[workspace.metadata.dist]`, wrapped in a `workspace` field: ```json { "workspace": { "cargo-dist-version": "0.1.0-prerelease.2", "ci": ["github"], "installers": ["shell", "powershell"], "targets": ["x86_64-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-pc-windows-msvc", "aarch64-apple-darwin"] } } ``` The given values will complete overwrite the `[workspace.metadata.dist]` section, so if any fields are omitted they will be deleted from the Cargo.toml. All the interactive logic that `init` supports will be ignored in this mode (this is *NOT* equivalent to --yes, which runs the logic and just accepts every prompt). generate-ci will be run afterwards as usual (disable with --no-generate-ci as usual). fixes #278
and make it generalized to all packages to be future-proof
For whatever reason it was reading it from workspace_metadata, which is just wrong (probably no one noticed, non-workspace config is rare with cargo-dist, and this settting is pretty naturally universal).
landing this to unblock some further cleanup work without making this pr spiral out of control |
This exists for hosted services that want to edit the toml mechanically.
The format is basically the json equivalent of
[workspace.metadata.dist]
,wrapped in a
workspace
field:The given values will complete overwrite the
[workspace.metadata.dist]
section,so if any fields are omitted they will be deleted from the Cargo.toml.
All the interactive logic that
init
supports will be ignored in this mode(this is NOT equivalent to --yes, which runs the logic and just accepts every prompt).
generate-ci will be run afterwards as usual (disable with --no-generate-ci as usual).
fixes #278