dnaka91 / cargo-hatch

Hatch new projects like a chick coming out of its egg
GNU Affero General Public License v3.0
7 stars 1 forks source link

conditional settings #10

Closed ModProg closed 1 year ago

ModProg commented 1 year ago

add a condition similarly to the file ignores to arguments to allow only querying some options when an earlier prompt was answered with yes.

[bin_install]
type = "bool"
description = "Enable binary installer (requires releases on GitHub)"
default = true

[github_repo]
type = "string"
description = "Enable binary installer (requires releases on GitHub)"
condition = "{{ bin_install }}"

should only ask for github_repo if bin_install is answered with yes.

dnaka91 commented 1 year ago

That's a nice idea. Will probably need a bit of internal restructuring for this one, to be able to run the condition templates with a partial context. In contrast, the file excludes are run after the context is filled with all the user input, so it's a bit simpler in that case.

But that shouldn't be too complex of a change.

ModProg commented 1 year ago

yeah, maybe this could be combined with #8

dnaka91 commented 1 year ago

This was actually easier than expected, as the internals were already in the right structure so that I only had to copy over pieces from the file filtering rules.

Just pushed the changes for it and will make a new release soon.