-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Set-WinGetUserSettings needs distinct parameters #4536
Comments
We went back and forth on the design choice with that. I can see the value in both approaches. We're also going to be doing some work with DSC v3 to enable WinGet to act as its own DSC resource. Given the distinction that some settings are user based and some require elevation, would you include that in the name, or just as a part of the output when the cmdlet is called? Naming things is hard... What names and arguments would you suggest? |
You should make this as easy for the user as possible. Don't force them to know the technical details. Give them an easy to use parameter that accepts pipeline input by property name. They can then pass parameters values directly, splat, or pipe into the command. |
Function Get-MonthAndDay {
param(
$Month = 7,
$Day = 4,
$hash = @{ month = $month; day = $day }
)
Get-Date -Month $hash.month -Day $hash.day
} |
You don't need a parameter that accepts a hashtable. That's what splatting is for. |
This is something I use for DSC Resource testing: $SplatParam = @{
Name = 'WindowsOptionalFeature'
ModuleName = 'PSDesiredStateConfiguration'
Method = 'Test'
Property = @{
Name = 'Containers-DisposableClientVM'
Ensure = 'Enable'
}
}
Invoke-DscResource @SplatParam $SplatParam = @{
Name = 'WindowsOptionalFeature'
ModuleName = 'PSDscResources'
Method = 'Test'
Property = @{
Name = 'Containers-DisposableClientVM'
Ensure = 'Present'
}
}
Invoke-DscResource @SplatParam I think what is being suggested is to be able to do something like this for the WinGet settings. |
Don't commingle the design considerations of a DSC resource with a PowerShell commands. They are very distinct in their requirements. |
@jdhitsolutions, what kind of proposed example do you have here? I value your expertise over mine very highly here 😊 I was just showing an example of what I have seen in terms of splatting. I could be way off base. I'm just being transparent about my ignorance. |
I do see the distinction between the interface we're proposing for WinGet as a DSC v3 resource and the PowerShell cmdlets a user would want to use to manage settings. |
I'd approach this in a more granular approach. First, how likely is the user going to need to change the Schema value? I also thing the default behavior is always to merge. Only set what the user specifies. I think all you need is a command with syntax like this:
I'd create a separate command called
As you add experimental features you would need to update this command. Also note that I changed to a singular noun to meet the accepted paradigm. From a DSC perspective, I can see where I want to configure a group of settings, but as an end-user I am likely to only need to change a single setting, like the progress bar. Does this make sense? |
Actually, I'd have to think a bit further on the experimental features cmdlet because I would need a way to turn something off and I don't like parameters that take Boolean values. But hopefully, you still get the idea. |
Makes sense. Thanks for the examples! |
Description of the new feature / enhancement
The
Set-WinGetUserSettings
cmdlets takes a hashtable of user settings. I think it would follow better PowerShell practice to define each setting as a separate parameter. If the user has a hashtable, they can splat to the cmdlet. The current design puts a burden on the user when they only want to modify a single setting.Proposed technical implementation details
Add parameters for settings like
ProgressBar
andUpdateInterval
. I would even suggest creating a separate command to set experimental features.The text was updated successfully, but these errors were encountered: