Closed ModProg closed 1 year ago
Oh, that's a nice idea. Was thinking of something similar for the (not yet implemented) test command, with an extra file that contains default answers.
Will take me a while to review this, though. Will let you know if I find a nicer solution to implement this.
Sorry, it has been a while. I started building this in a slightly different way. Still pretty much the same thing, just a few relocations.
Also, I feel it's worth further extending this, to optionally completely skip the prompts. So, based on the config, it'll just take the set value and go directly to the next input that requires a prompt (if set).
Sorry, it has been a while. I started building this in a slightly different way. Still pretty much the same thing, just a few relocations.
Also, I feel it's worth further extending this, to optionally completely skip the prompts. So, based on the config, it'll just take the set value and go directly to the next input that requires a prompt (if set).
makes sense, would like to have a way to either set a default or set the actual value, as sometimes it is just the preffered thing and sometimes it is the only thing I'll ever want.
Exactly. Sometimes you prefer some value more often over another (in contrast to what the template author thinks is the right default).
And then sometimes there are some values, that you always answer the same, so you can trim down the mount of inputs to only, what matters to you.
So far I was just tinkering around with this myself, ended up with something that only implements the latter. Your PR implements the 1st case. Now will just combine them, and we're good to go :D
I have both the prompt defaults, and skipping of prompts implemented well locally now. Will test around with it in the next few days and push it.
Once I pushed it, I'll let you know, and then you can probably close this PR. I will try to rebase my local commits on top of this PR, to have you in the commit history as well. Would be unfair to not have you mentioned there anywhere, as you gave the initial idea for this 👍.
I committed this, combined with the mentioned ideas of myself in https://github.com/dnaka91/cargo-hatch/commit/84c4f263cb21507a32b96d753294b35bdf195db1. Added you as a co-author in the commit message, as there is no other link to this PR. To be honest, I didn't test this final implementation much yet, but it should mostly work.
Will do some other changes and then publish a new version.
By far not the cleanest implementation, if you think this or someone like this makes sense, this would probably need to be partly refactored.
This is more of a quickly thrown together aproach to having some form of global values.
I first thought of global values set for all templates, but that would easily clash because multiple templates could use the same key for different use cases.
(My usecase is e.g. the GitHub account/org).