Open Meir017 opened 7 years ago
@Meir017 Good initiative!
I think however that the current way of building tool arguments gives more flexibility of how and when to include parameters, which have proven useful in the past. Especially in cases where you want to exclude or include other arguments depending what settings have been set and similar. Sometimes it's not a 1:1 mapping between what settings have been set and what arguments that get rendered.
This could absolutely be added in an optional addin though!
What you are describing sounds a bit like the ParameterSetName
in the attribute ParameterAttribute
in powershell. (source code)
Would it be possible to somehow reused the attributes from powershell? If something like this would be possible it will also mean that we will be able to generate from these settings files powershell autocomplete for tools.
Can you give an example of the case you described where an argument depends on another argument?
@Meir017 as @patriksvensson said, I don't think that this is something that we would want to roll out across the board, however, there is nothing to stop you doing something like this in your own addins.
There is already examples of doing this in this addin:
Suggestion:
Right now for tool the settings are converted to the command line arguments manually which seems to me a bit awkward.
I had an idea to use attributes on the settings classes properties that will contain metadata on how each property should be handled - similar to how Powershell function work.
not sure if it would be possible to use the powershell attributes directly
for example:
For properties that are represented as
-X=Y
or similar the template property will be something like-X={0}
.for switch parameters:
for collection parameters:
This will improve the generated docs by listing next to each property it's template
Tested a small POC - https://github.com/Meir017/Playground/blob/master/cake-tool-settings-attributes.cs
any thoughts?