-
Notifications
You must be signed in to change notification settings - Fork 378
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
Update PostAction with symbol parameters to cmd file arguments #1600
Comments
Currently, post-actions do not support accessing user input. As a workaround, you could change setup.cmd to contain the values you're currently passing (or generate another script that calls setup.cmd) - treating that file like normal template content |
Closing this since there hasn't been any activity. Please let us know if this approach doesn't work for your use case. |
@mlorbetske I think, it will be very useful - be able to pass the symbols in postAction. I'd like to solve a similiar use case. I want to run command like this: {
"actionId": "3A7C4B45-1F5D-4A30-959A-51B88E82B5D2",
"args": {
"executable": "dotnet",
"args": "run /seed --project src/(name).csproj"
},
"manualInstructions": [
{
"text": "Seeds the initial user database"
}
],
"continueOnError": false,
"description ": "seeds the database"
} I need get the name of created csproj according user input. |
@skoruba currently, this would be achieved by including script files in your template content that execute the command you want (presumably you’d want both a .cmd file and a .sh file) that perform the action you’d like and call the script file from the post-action. The script file being subject to the operations set up in template.json, if it contains the original value of sourceName (and either sourceName has distinct value forms, or a derived symbol is used to capture the identity form), after creation it would contain the name the user had chosen. |
Thanks all for the suggestions, however we were expecting some straight forward approach. I hope we can suggest this type of requirements as Enhancement feature. |
A post-action rework with access to parameters & such has been on our radar for a while now, the responses here were intended to help enable this sort of functionality in the short run. I’ll re-open this to make sure we track this scenario. |
|
Just to add another use case: the previous suggested workaround of using a symbol replacement in the script file itself isn't always viable, because the action might be e.g. to encrypt and/or store sensitive information such as a client secret somewhere. |
@wazzamatazz , thanks for the additional details. We are currently updating documents (working through that particular backlog). We can then move on to the "Template authoring" backlog, relevant to this issue. Please stay tuned. |
Reported in July 2018, nothing done in October 2021. |
This can be also helpful for other post actions:
|
The issue was resolved in #6312. See more details in https://github.com/dotnet/templating/blob/main/docs/Post-Action-Registry.md#base-configuration |
I need to pass symbols parameters to args when executing setup.cmd file using postActions property as below .template.config file.
Here, i am passing two symbols of type string jsonFileNamePath and myfilename as arguments to setup.cmd.
The text was updated successfully, but these errors were encountered: