Comments (11)
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.
from winget-cli.
You don't need a parameter that accepts a hashtable. That's what splatting is for.
from winget-cli.
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.
from winget-cli.
Don't commingle the design considerations of a DSC resource with a PowerShell commands. They are very distinct in their requirements.
from winget-cli.
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:
PS D:\> Get-Command Set-WinGetUserSetting -syntax
Set-WinGetUserSetting [[-AutoUpdateInterval] <int>] [[-ProgressBar] <string>] [<CommonParameters>]
I'd create a separate command called Set-WingetUserExperimentalFeature
that right now would look like :
PS D:\> Get-Command Set-WinGetUserExperimentalSetting -syntax
Set-WinGetUserExperimentalSetting [-List] [-Upgrade] [<CommonParameters>]
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?
from winget-cli.
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?
from winget-cli.
Requiring a properly-formatted hashtable of data is an advanced user input method. PowerShell functions and cmdlets should be open to all users, not just advanced users who have researched a particular area.
The way to do this is to construct the PowerShell function in such a way that the upper parameters define the details - and the last parameter accept the hashtable, with its default value being a hashtable of all of the parameters above it. This is essentially a "sideways wrapper" with an advanced input method.
Example:
Function Get-MonthAndDay {
param(
$Month = 7,
$Day = 4,
$hash = @{ month = $month; day = $day }
)
Get-Date -Month $hash.month -Day $hash.day
}
from winget-cli.
@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.
from winget-cli.
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.
from winget-cli.
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.
from winget-cli.
Makes sense. Thanks for the examples!
from winget-cli.
Related Issues (20)
- winget install: If a single download fails or a paket was renamed, all following installs are skipped, even with --force HOT 2
- Winget acting strange after moving package cache and temp to Dev-Drive HOT 11
- `Update-WinGetPackage -WhatIf`: Installs the update instead of saying what it would do
- Recommendation to Standardize Symbol Usage to Avoid Mixing HOT 1
- Bug Report: `winget update` Package List Issue HOT 4
- winget upgrade -r / --recurse / --all stopped working HOT 10
- winget install --scope machine stopped working HOT 9
- Reoccurrence of Issue #4141 for IOBit.AdvancedSystemCare version 17.5.0.xxx HOT 2
- --exact results in not finding package even when exact is installed HOT 3
- Manifest validation succeeds when NestedInstaller(Type | Files) is used for non-zip packages HOT 1
- winget repeatedly updates same package HOT 11
- Update README.md HOT 1
- `Get-WinGetConfiguration` can't open a valid WinGet config file HOT 3
- `Get-WinGetConfiguration` default `-Path` to what `winget config` points to HOT 2
- VSCode Insiders fails to update HOT 6
- how to enable side-by-side in V1.9.1792-preview HOT 3
- WinGet Download presents error when it should be a warning.
- WinGet download installs more than one bundle. It should be latest
- WinGet download has unhelpful error text when download not supported.
- FortiClient VPN Package update failure (FortiClient ZTNA replaced FortClient VPN Only client) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from winget-cli.